mini support to ctimeCli
This commit is contained in:
@@ -271,6 +271,8 @@ export interface Entity {
|
||||
keyRaw: string;
|
||||
mtimeCli?: number;
|
||||
mtimeCliFmt?: string;
|
||||
ctimeCli?: number;
|
||||
ctimeCliFmt?: string;
|
||||
mtimeSvr?: number;
|
||||
mtimeSvrFmt?: string;
|
||||
prevSyncTime?: number;
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ export async function copyFile(key: string, left: FakeFs, right: FakeFs) {
|
||||
key,
|
||||
content,
|
||||
statsLeft.mtimeCli,
|
||||
statsLeft.mtimeCli /* TODO */
|
||||
statsLeft.ctimeCli ?? statsLeft.mtimeCli
|
||||
),
|
||||
content: content,
|
||||
};
|
||||
|
||||
@@ -133,8 +133,10 @@ export class FakeFsLocal extends FakeFs {
|
||||
return {
|
||||
key: isFolder ? `${key}/` : key, // local always unencrypted
|
||||
keyRaw: isFolder ? `${key}/` : key,
|
||||
ctimeCli: statRes.ctime,
|
||||
mtimeCli: statRes.mtime,
|
||||
mtimeSvr: statRes.mtime,
|
||||
ctimeCliFmt: unixTimeToStr(statRes.ctime),
|
||||
mtimeCliFmt: unixTimeToStr(statRes.mtime),
|
||||
mtimeSvrFmt: unixTimeToStr(statRes.mtime),
|
||||
size: statRes.size, // local always unencrypted
|
||||
|
||||
@@ -403,13 +403,23 @@ ${constructFromDriveItemToEntityError(x)}`
|
||||
if (mtimeTry === undefined || mtimeTry === null) {
|
||||
throw Error(`onedrive cannot parse mtime: ${JSON.stringify(x, null, 2)}`);
|
||||
}
|
||||
|
||||
let ctimeTry = x?.fileSystemInfo?.createdDateTime;
|
||||
if (ctimeTry === undefined || ctimeTry === null) {
|
||||
// throw Error(`onedrive cannot parse ctime: ${JSON.stringify(x, null, 2)}`);
|
||||
// it doesn't hurt, we just use mtimeTry to fullfill
|
||||
ctimeTry = mtimeTry;
|
||||
}
|
||||
|
||||
const mtimeSvr = Date.parse(mtimeTry);
|
||||
const mtimeCli = Date.parse(mtimeTry);
|
||||
const ctimeCli = Date.parse(ctimeTry);
|
||||
return {
|
||||
key: key,
|
||||
keyRaw: key,
|
||||
mtimeSvr: mtimeSvr,
|
||||
mtimeCli: mtimeCli,
|
||||
ctimeCli: ctimeCli,
|
||||
size: isFolder ? 0 : x.size!,
|
||||
sizeRaw: isFolder ? 0 : x.size!,
|
||||
synthesizedFile: false,
|
||||
@@ -878,6 +888,7 @@ export class FakeFsOnedrive extends FakeFs {
|
||||
keyRaw: origKey,
|
||||
mtimeSvr: mtime,
|
||||
mtimeCli: mtime,
|
||||
ctimeCli: ctime,
|
||||
size: 0,
|
||||
sizeRaw: 0,
|
||||
synthesizedFile: true,
|
||||
|
||||
Reference in New Issue
Block a user