add more prefix
This commit is contained in:
parent
7bc2fad88b
commit
50c08400ff
@ -252,6 +252,10 @@ const fromDriveItemToEntity = (x: DriveItem, remoteBaseDir: string): Entity => {
|
|||||||
// why?? /drive/root:/Apps/Graph
|
// why?? /drive/root:/Apps/Graph
|
||||||
const FIFTH_COMMON_PREFIX_REGEX = /^\/drive\/root:\/[^\/]+\/Graph\//g;
|
const FIFTH_COMMON_PREFIX_REGEX = /^\/drive\/root:\/[^\/]+\/Graph\//g;
|
||||||
|
|
||||||
|
// why again?? /drive/root:/Apps/Graph 1
|
||||||
|
const SIXTH_COMMON_PREFIX_REGEX = /^\/drive\/root:\/[^\/]+\/Graph 1\//g;
|
||||||
|
const SIXTH_COMMON_PREFIX_REGEX_V2 = /^\/drive\/root:\/[^\/]+\/Graph%201\//g;
|
||||||
|
|
||||||
// or the root is absolute path /Livefolders,
|
// or the root is absolute path /Livefolders,
|
||||||
// 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;
|
||||||
@ -278,6 +282,11 @@ const fromDriveItemToEntity = (x: DriveItem, remoteBaseDir: string): Entity => {
|
|||||||
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 matchFifthPrefixRes = fullPathOriginal.match(FIFTH_COMMON_PREFIX_REGEX);
|
const matchFifthPrefixRes = fullPathOriginal.match(FIFTH_COMMON_PREFIX_REGEX);
|
||||||
|
const matchSixthPrefixRes = fullPathOriginal.match(SIXTH_COMMON_PREFIX_REGEX);
|
||||||
|
const matchSixthV2PrefixRes = fullPathOriginal.match(
|
||||||
|
SIXTH_COMMON_PREFIX_REGEX_V2
|
||||||
|
);
|
||||||
|
|
||||||
const matchSecondPrefixRes = fullPathOriginal.match(
|
const matchSecondPrefixRes = fullPathOriginal.match(
|
||||||
SECOND_COMMON_PREFIX_REGEX
|
SECOND_COMMON_PREFIX_REGEX
|
||||||
);
|
);
|
||||||
@ -317,6 +326,40 @@ const fromDriveItemToEntity = (x: DriveItem, remoteBaseDir: string): Entity => {
|
|||||||
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sixth
|
||||||
|
else if (
|
||||||
|
matchSixthPrefixRes !== null &&
|
||||||
|
fullPathOriginal.startsWith(`${matchSixthPrefixRes[0]}${remoteBaseDir}`)
|
||||||
|
) {
|
||||||
|
const foundPrefix = `${matchSixthPrefixRes[0]}${remoteBaseDir}`;
|
||||||
|
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
||||||
|
} else if (
|
||||||
|
matchSixthPrefixRes !== null &&
|
||||||
|
fullPathOriginal.startsWith(
|
||||||
|
`${matchSixthPrefixRes[0]}${remoteBaseDirEncoded}`
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
const foundPrefix = `${matchSixthPrefixRes[0]}${remoteBaseDirEncoded}`;
|
||||||
|
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// sixth v2
|
||||||
|
else if (
|
||||||
|
matchSixthV2PrefixRes !== null &&
|
||||||
|
fullPathOriginal.startsWith(`${matchSixthV2PrefixRes[0]}${remoteBaseDir}`)
|
||||||
|
) {
|
||||||
|
const foundPrefix = `${matchSixthV2PrefixRes[0]}${remoteBaseDir}`;
|
||||||
|
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
||||||
|
} else if (
|
||||||
|
matchSixthV2PrefixRes !== null &&
|
||||||
|
fullPathOriginal.startsWith(
|
||||||
|
`${matchSixthV2PrefixRes[0]}${remoteBaseDirEncoded}`
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
const foundPrefix = `${matchSixthV2PrefixRes[0]}${remoteBaseDirEncoded}`;
|
||||||
|
key = fullPathOriginal.substring(foundPrefix.length + 1);
|
||||||
|
}
|
||||||
|
|
||||||
// second
|
// second
|
||||||
else if (
|
else if (
|
||||||
matchSecondPrefixRes !== null &&
|
matchSecondPrefixRes !== null &&
|
||||||
@ -374,6 +417,8 @@ const fromDriveItemToEntity = (x: DriveItem, remoteBaseDir: string): Entity => {
|
|||||||
fullPathOriginal=${fullPathOriginal}
|
fullPathOriginal=${fullPathOriginal}
|
||||||
matchFirstPrefixRes=${matchFirstPrefixRes}
|
matchFirstPrefixRes=${matchFirstPrefixRes}
|
||||||
matchFifthPrefixRes=${matchFifthPrefixRes}
|
matchFifthPrefixRes=${matchFifthPrefixRes}
|
||||||
|
matchSixthPrefixRes=${matchSixthPrefixRes}
|
||||||
|
matchSixthV2PrefixRes=${matchSixthV2PrefixRes}
|
||||||
matchSecondPrefixRes=${matchSecondPrefixRes}
|
matchSecondPrefixRes=${matchSecondPrefixRes}
|
||||||
matchThirdPrefixRes=${matchThirdPrefixRes}
|
matchThirdPrefixRes=${matchThirdPrefixRes}
|
||||||
${constructFromDriveItemToEntityError(x)}`
|
${constructFromDriveItemToEntityError(x)}`
|
||||||
@ -388,6 +433,8 @@ ${constructFromDriveItemToEntityError(x)}`
|
|||||||
fullPathOriginal=${fullPathOriginal}
|
fullPathOriginal=${fullPathOriginal}
|
||||||
matchFirstPrefixRes=${matchFirstPrefixRes}
|
matchFirstPrefixRes=${matchFirstPrefixRes}
|
||||||
matchFifthPrefixRes=${matchFifthPrefixRes}
|
matchFifthPrefixRes=${matchFifthPrefixRes}
|
||||||
|
matchSixthPrefixRes=${matchSixthPrefixRes}
|
||||||
|
matchSixthV2PrefixRes=${matchSixthV2PrefixRes}
|
||||||
matchSecondPrefixRes=${matchSecondPrefixRes}
|
matchSecondPrefixRes=${matchSecondPrefixRes}
|
||||||
matchThirdPrefixRes=${matchThirdPrefixRes}
|
matchThirdPrefixRes=${matchThirdPrefixRes}
|
||||||
${constructFromDriveItemToEntityError(x)}`
|
${constructFromDriveItemToEntityError(x)}`
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user