add more compability to onedrive
This commit is contained in:
parent
b99053ef10
commit
071b10387c
@ -273,14 +273,20 @@ const fromDriveItemToRemoteItem = (
|
|||||||
// e.g.: /Livefolders/应用/remotely-save/${remoteBaseDir}
|
// e.g.: /Livefolders/应用/remotely-save/${remoteBaseDir}
|
||||||
const SECOND_COMMON_PREFIX_REGEX = /^\/Livefolders\/[^\/]+\/remotely-save\//g;
|
const SECOND_COMMON_PREFIX_REGEX = /^\/Livefolders\/[^\/]+\/remotely-save\//g;
|
||||||
|
|
||||||
|
// another report, why???
|
||||||
|
// /drive/root:/something/app/remotely-save/${remoteBaseDir}
|
||||||
|
const THIRD_COMMON_PREFIX_REGEX =
|
||||||
|
/^\/drive\/root:\/[^\/]+\/app\/remotely-save\//g;
|
||||||
|
|
||||||
// another possibile prefix
|
// another possibile prefix
|
||||||
const THIRD_COMMON_PREFIX_RAW = `/drive/items/`;
|
const FOURTH_COMMON_PREFIX_RAW = `/drive/items/`;
|
||||||
|
|
||||||
const fullPathOriginal = `${x.parentReference.path}/${x.name}`;
|
const fullPathOriginal = `${x.parentReference.path}/${x.name}`;
|
||||||
const matchFirstPrefixRes = fullPathOriginal.match(FIRST_COMMON_PREFIX_REGEX);
|
const matchFirstPrefixRes = fullPathOriginal.match(FIRST_COMMON_PREFIX_REGEX);
|
||||||
const matchSecondPrefixRes = fullPathOriginal.match(
|
const matchSecondPrefixRes = fullPathOriginal.match(
|
||||||
SECOND_COMMON_PREFIX_REGEX
|
SECOND_COMMON_PREFIX_REGEX
|
||||||
);
|
);
|
||||||
|
const matchThirdPrefixRes = fullPathOriginal.match(THIRD_COMMON_PREFIX_REGEX);
|
||||||
if (
|
if (
|
||||||
matchFirstPrefixRes !== null &&
|
matchFirstPrefixRes !== null &&
|
||||||
fullPathOriginal.startsWith(`${matchFirstPrefixRes[0]}${remoteBaseDir}`)
|
fullPathOriginal.startsWith(`${matchFirstPrefixRes[0]}${remoteBaseDir}`)
|
||||||
@ -293,7 +299,13 @@ const fromDriveItemToRemoteItem = (
|
|||||||
) {
|
) {
|
||||||
const foundPrefix = `${matchSecondPrefixRes[0]}${remoteBaseDir}`;
|
const foundPrefix = `${matchSecondPrefixRes[0]}${remoteBaseDir}`;
|
||||||
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
||||||
} else if (x.parentReference.path.startsWith(THIRD_COMMON_PREFIX_RAW)) {
|
} else if (
|
||||||
|
matchThirdPrefixRes !== null &&
|
||||||
|
fullPathOriginal.startsWith(`${matchThirdPrefixRes[0]}${remoteBaseDir}`)
|
||||||
|
) {
|
||||||
|
const foundPrefix = `${matchThirdPrefixRes[0]}${remoteBaseDir}`;
|
||||||
|
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
||||||
|
} else if (x.parentReference.path.startsWith(FOURTH_COMMON_PREFIX_RAW)) {
|
||||||
// it's something like
|
// it's something like
|
||||||
// /drive/items/<some_id>!<another_id>:/${remoteBaseDir}/<subfolder>
|
// /drive/items/<some_id>!<another_id>:/${remoteBaseDir}/<subfolder>
|
||||||
// with uri encoded!
|
// with uri encoded!
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user