Some more cleanup
This commit is contained in:
+17
-23
@@ -7,32 +7,26 @@ on:
|
||||
branches: ["main"]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Setup repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
steps:
|
||||
- name: Setup repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Setup Deno
|
||||
uses: denoland/setup-deno@v2
|
||||
with:
|
||||
deno-version: v2.5.0
|
||||
- name: Setup Deno
|
||||
uses: denoland/setup-deno@v2
|
||||
with:
|
||||
deno-version: v2.5.0
|
||||
|
||||
- name: Run build
|
||||
run: deno task build
|
||||
- name: Run build
|
||||
run: deno task build
|
||||
|
||||
- name: Run type check
|
||||
run: deno task check
|
||||
|
||||
- name: Run lint
|
||||
run: deno task lint
|
||||
|
||||
- name: Run tests
|
||||
run: deno task test
|
||||
- name: Run checks
|
||||
run: deno task checks
|
||||
|
||||
@@ -103,15 +103,7 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
||||
async getFileMeta(path: string, _observing?: boolean): Promise<FileMeta> {
|
||||
const localPath = this.filenameToPath(path);
|
||||
try {
|
||||
const s = await Deno.stat(localPath);
|
||||
return {
|
||||
name: path,
|
||||
size: s.size,
|
||||
contentType: lookupContentType(path),
|
||||
created: s.birthtime?.getTime() || s.mtime?.getTime() || 0,
|
||||
lastModified: s.mtime?.getTime() || 0,
|
||||
perm: "rw",
|
||||
};
|
||||
return this.fileInfoToFileMeta(path, await Deno.stat(localPath));
|
||||
} catch (e: any) {
|
||||
if (e instanceof Deno.errors.NotFound) {
|
||||
throw notFoundError;
|
||||
@@ -121,6 +113,17 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
||||
}
|
||||
}
|
||||
|
||||
private fileInfoToFileMeta(path: string, s: Deno.FileInfo): FileMeta {
|
||||
return {
|
||||
name: path,
|
||||
size: s.size,
|
||||
contentType: lookupContentType(path),
|
||||
created: s.birthtime?.getTime() || s.mtime?.getTime() || 0,
|
||||
lastModified: s.mtime?.getTime() || 0,
|
||||
perm: "rw",
|
||||
};
|
||||
}
|
||||
|
||||
async deleteFile(path: string): Promise<void> {
|
||||
const localPath = this.filenameToPath(path);
|
||||
try {
|
||||
@@ -176,14 +179,9 @@ export class DiskSpacePrimitives implements SpacePrimitives {
|
||||
try {
|
||||
const s = await Deno.stat(fullPath);
|
||||
const name = fullPath.substring(this.rootPath.length + 1);
|
||||
allFiles.push({
|
||||
name: normalizeForwardSlashPath(name),
|
||||
created: s.birthtime?.getTime() || s.mtime?.getTime() || 0,
|
||||
lastModified: s.mtime?.getTime() || 0,
|
||||
contentType: mime.getType(fullPath) || "application/octet-stream",
|
||||
size: s.size,
|
||||
perm: "rw",
|
||||
});
|
||||
allFiles.push(
|
||||
this.fileInfoToFileMeta(normalizeForwardSlashPath(name), s),
|
||||
);
|
||||
} catch (e: any) {
|
||||
if (e instanceof Deno.errors.NotFound) {
|
||||
// Ignore, temporariy file already deleted by the time we got here
|
||||
|
||||
+2
-3
@@ -71,7 +71,6 @@ export class SpaceSync extends EventEmitter<SyncEvents> {
|
||||
constructor(
|
||||
private primary: SpacePrimitives,
|
||||
private secondary: SpacePrimitives,
|
||||
// public snapshot: SyncSnapshot,
|
||||
readonly options: SyncOptions,
|
||||
) {
|
||||
super();
|
||||
@@ -409,8 +408,8 @@ export class SpaceSync extends EventEmitter<SyncEvents> {
|
||||
} else if (
|
||||
primaryMeta !== undefined && secondaryMeta !== undefined &&
|
||||
snapshot.files.get(path) &&
|
||||
secondaryMeta.lastModified !== snapshot.files.get(path)![1] &&
|
||||
primaryMeta.lastModified === snapshot.files.get(path)![0]
|
||||
primaryMeta.lastModified === snapshot.files.get(path)![0] &&
|
||||
secondaryMeta.lastModified !== snapshot.files.get(path)![1]
|
||||
) {
|
||||
// File has changed on secondary, but not primary
|
||||
if (syncBack) {
|
||||
|
||||
Reference in New Issue
Block a user