Skip to content

Commit

Permalink
feat: desktop: sync: lift local directory strictness
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed Nov 25, 2024
1 parent da852d0 commit 213e2cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export const DISALLOWED_SYNC_DIRS = [
"C:\\Windows",
"C:\\Program Files",
"C:\\Program Files (x86)",
`C:\\Users\\${process.env.USER ?? "User"}\\AppData`,
`C:\\Users\\${process.env.USER ?? "User"}\\AppData\\Local`,
`C:\\Users\\${process.env.USER ?? "User"}\\AppData\\LocalLow`,
"C:\\Temp",
"C:\\Windows\\Temp",
"/System",
Expand All @@ -28,7 +29,7 @@ export const DISALLOWED_SYNC_DIRS = [
"/usr",
"/bin",
"/sbin",
"/var",
//"/var",
"/tmp",
"/private",
`/home/${process.env.USER ?? "User"}/.cache`
Expand Down
8 changes: 4 additions & 4 deletions src/ipc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ export class IPC {
const normalizedPath = pathModule.normalize(path)

for (const disallowedDir of DISALLOWED_SYNC_DIRS) {
if (normalizedPath.startsWith(pathModule.normalize(disallowedDir))) {
if (normalizedPath.startsWith(pathModule.normalize(disallowedDir) + pathModule.sep)) {
return false
}
}
Expand All @@ -935,9 +935,9 @@ export class IPC {
return false
}

if (process.platform === "win32" && normalizedPath.startsWith("\\")) {
return false
}
// if (process.platform === "win32" && normalizedPath.startsWith("\\")) {
// return false
// }

const stat = await fs.lstat(path)

Expand Down

0 comments on commit 213e2cd

Please sign in to comment.