mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-02 14:02:21 +02:00
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:
parent
0280625898
commit
3e35e20cc5
10
src/sync.d
10
src/sync.d
|
@ -6,6 +6,7 @@ import std.file, std.json, std.path;
|
||||||
import std.regex;
|
import std.regex;
|
||||||
import std.stdio, std.string, std.uni, std.uri;
|
import std.stdio, std.string, std.uni, std.uri;
|
||||||
import std.conv;
|
import std.conv;
|
||||||
|
import std.encoding;
|
||||||
import core.time, core.thread;
|
import core.time, core.thread;
|
||||||
import core.stdc.stdlib;
|
import core.stdc.stdlib;
|
||||||
import config, itemdb, onedrive, selective, upload, util;
|
import config, itemdb, onedrive, selective, upload, util;
|
||||||
|
@ -1578,6 +1579,15 @@ final class SyncEngine
|
||||||
return;
|
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){
|
if(path.byGrapheme.walkLength < maxPathLength){
|
||||||
// path is less than maxPathLength
|
// path is less than maxPathLength
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue