solid-client-js icon indicating copy to clipboard operation
solid-client-js copied to clipboard

Use `If-None-Match` header when saving a file

Open NSeydoux opened this issue 4 years ago • 1 comments

Currently, unstable_overwriteFile(fileUrl: RequestInfo, file: Blob, options explicitly overwrites any data at the provided URL. A more subtle behaviour would be to change it to unstable_saveFile(fileUrl: RequestInfo, file: Blob, options), with options including a parameter overwrite: boolean set to true by default (to be consistent with the default behaviour of unstable_overwriteFile that would be replaced by unstable_saveFile).

Under the cover, the library would set the If-None-Match header for the server to check if a resource already exists at the provided URL.

This feature should coordinate with https://github.com/solid/node-solid-server/issues/1431.

NSeydoux avatar Jun 16 '20 08:06 NSeydoux

with options including a parameter overwrite: boolean set to true by default (to be consistent with the default behaviour of unstable_overwriteFile that would be replaced by unstable_saveFile).

I'd set it to false by default to avoid unintended data loss, and simply make overwriteFile a wrapper that sets it to true during its deprecation period.

Vinnl avatar Jun 16 '20 08:06 Vinnl