pondersource / remotestorage.js

⬡ JavaScript client library for integrating remoteStorage in apps
https://remotestoragejs.readthedocs.io
MIT License
0 stars 0 forks source link

How to handle ifMatch properly in the put function options for Solid backend #1

Open yasharpm opened 3 months ago

yasharpm commented 3 months ago

All backends (including the Solid backend) are subclasses of the RemoteBase class and Remote interface defined inside the remote.ts file. The description for the put function is as follows:

Create or update a file. options.ifNoneMatch - When *, only create or update the file if it doesn't yet exist options.ifMatch - Only saves if this matches current revision

Note that this function description is taken from the Dropbox backend. The GoogleDrive backend lacks the options.ifMatch description but behaves the same.

Studying the GoogleDrive code tells me that if the file already exists and the options.ifMatch is set, I have to check the ETAG of the file on the remote source and only update if it matches. Google drive already supports setting the etag and this condition in the update request to their server.

In order to implement the same for the Solid backend I could not find any similar functionality in the Inrupt library source code neither any mention of it in their documentation.

What should I do here? I can ignore the etag and change the put function description for the solid backend. Or maybe if this is basically possible in the Solid protocol and implementations, I can come up with a pull request to the Inrupt library or even find a hack.

yasharpm commented 3 months ago

@michielbdejong thoughts?