Update sync.d (#493)

* Add an encoding validation check before any path length checks are performed as if the path contains any invalid UTF-8 sequences, the path walk to establish valid path length will fail
This commit is contained in:
abraunegg 2019-05-13 07:52:49 -04:00 committed by GitHub
parent 0280625898
commit 3e35e20cc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ import std.file, std.json, std.path;
import std.regex;
import std.stdio, std.string, std.uni, std.uri;
import std.conv;
import std.encoding;
import core.time, core.thread;
import core.stdc.stdlib;
import config, itemdb, onedrive, selective, upload, util;
@ -1578,6 +1579,15 @@ final class SyncEngine
return;
}
// Invalid UTF-8 sequence check
// https://github.com/skilion/onedrive/issues/57
// https://github.com/abraunegg/onedrive/issues/487
if(!isValid(path)) {
// Path is not valid according to https://dlang.org/phobos/std_encoding.html
log.vlog("Skipping item - invalid character sequences: ", path);
return;
}
if(path.byGrapheme.walkLength < maxPathLength){
// path is less than maxPathLength