Files
jsonPrism/src-tauri/capabilities/default.json
T
poli0981andClaude Opus 4.7 8a27c5c969 fix(tauri): set File.lastModified from stat() so batch dedup works (v1.3.3) (#27)
`fileFromNativePath` was calling `new File([text], name, { type })`
without `lastModified`. The File API defaults `lastModified` to
`Date.now()` at construction time, so reading the same path twice
produced two File objects with different timestamps — and `batchStore`
dedups on `(name, size, lastModified)`, so dropping the same file
twice through Tauri native drag-drop / native picker added both
copies to the queue with no `duplicate` toast. Web wasn't affected
because `<input type="file">` and `react-dropzone` build File objects
from the OS mtime.

Fix: call `stat()` from `@tauri-apps/plugin-fs` and pass
`mtime.getTime()` into the File constructor. Fall back to an FNV-1a
hash of the path if stat throws (capability missing, file vanished
between read and stat) so repeat drops still dedup.

Also infer `type` from the extension instead of hard-coding
`application/json`. Add `fs:allow-stat` to the default capability.

3 new unit tests for `pathHashAsMillis`. Total: 193.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 20:33:12 +07:00

30 lines
763 B
JSON

{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Default permissions for the JSONPrism main window.",
"windows": ["main"],
"permissions": [
"core:default",
"core:event:allow-listen",
"core:event:allow-unlisten",
"core:webview:default",
"core:window:default",
"core:window:allow-set-title",
"shell:allow-open",
"os:default",
"dialog:default",
"dialog:allow-open",
"dialog:allow-save",
"dialog:allow-message",
"fs:default",
"fs:allow-read-text-file",
"fs:allow-write-text-file",
"fs:allow-write-file",
"fs:allow-stat",
{
"identifier": "fs:scope",
"allow": ["$HOME/**", "$DOCUMENT/**", "$DOWNLOAD/**", "$DESKTOP/**"]
}
]
}