mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-10 09:46:40 +02:00
Update path and naming limitations
* Resolve https://github.com/abraunegg/onedrive/issues/6 * Update OneDrive Business path length to 400 characters * Update allowed characters for path and file names
This commit is contained in:
parent
bc815541b6
commit
3381511e19
|
@ -817,7 +817,7 @@ final class SyncEngine
|
|||
|
||||
private void uploadNewItems(string path)
|
||||
{
|
||||
// https://github.com/OneDrive/onedrive-api-docs/issues/443
|
||||
// https://support.microsoft.com/en-us/help/3125202/restrictions-and-limitations-when-you-sync-files-and-folders
|
||||
// If the path is greater than allowed characters, then one drive will return a '400 - Bad Request'
|
||||
// Need to ensure that the URI is encoded before the check is made
|
||||
// 256 Character Limit for OneDrive Business / Office 365
|
||||
|
@ -825,7 +825,7 @@ final class SyncEngine
|
|||
auto maxPathLength = 0;
|
||||
if (accountType == "business"){
|
||||
// Business Account
|
||||
maxPathLength = 256;
|
||||
maxPathLength = 400;
|
||||
} else {
|
||||
// Personal Account
|
||||
maxPathLength = 430;
|
||||
|
|
|
@ -140,12 +140,13 @@ bool isValidName(string path)
|
|||
|
||||
// Restriction and limitations about windows naming files
|
||||
// https://msdn.microsoft.com/en-us/library/aa365247
|
||||
// https://support.microsoft.com/en-us/help/3125202/restrictions-and-limitations-when-you-sync-files-and-folders
|
||||
auto invalidNameReg =
|
||||
ctRegex!(
|
||||
// leading whitespace and trailing whitespace/dot
|
||||
`^\s.*|^.*[\s\.]$|` ~
|
||||
// invalid character
|
||||
`.*[#%<>:"\|\?*/\\].*|` ~
|
||||
`.*[<>:"\|\?*/\\].*|` ~
|
||||
// reserved device name and trailing .~
|
||||
`(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:[.].+)?$`
|
||||
);
|
||||
|
@ -165,8 +166,6 @@ unittest
|
|||
assert(!isValidName("./ leading_white_space"));
|
||||
assert(!isValidName("./trailing_white_space "));
|
||||
assert(!isValidName("./trailing_dot."));
|
||||
assert(!isValidName("./includes#in the path"));
|
||||
assert(!isValidName("./includes%in the path"));
|
||||
assert(!isValidName("./includes<in the path"));
|
||||
assert(!isValidName("./includes>in the path"));
|
||||
assert(!isValidName("./includes:in the path"));
|
||||
|
|
Loading…
Reference in a new issue