-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create/update file values in API v2 #998
Comments
Is there actually any reason for the client to submit files to Knora? Couldn't it just submit them to Sipi, then just tell Knora about the metadata? |
This would br much better!! I support this solution. We have only mske SIPI get the permission for upload from Knora. That should not be a problem...
Von meinem iPhone gesendet
Am 21.09.2018 um 12:13 schrieb Benjamin Geer <[email protected]<mailto:[email protected]>>:
Is there actually any reason for the client to submit files to Knora? Couldn't it just submit them to Sipi, then just tell Knora about the metadata?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#998 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFN9zBcZN1kh59Kj_GdrvHBxwnr9klXYks5udLvcgaJpZM4WyZXm>.
|
For the user, it is simpler to send a request to knora and then let the knora/sipi magic happen behind the scene. This is very much in the bulk import way of doing (I just don't like the implementation that expect a shared directory between knora and sipi). For the user again, The current GUI Case is more convoluted (sending a file to sipi, keep the returned iri, send it to knora). |
I'm not sure it's really simpler. To make this work in API v2, you would need to send a single
So in any case this would be different and more complex than a normal POST/PUT request. If you send the files to Sipi first, you will have to construct exactly the same JSON-LD request (referring to the files that you sent to Sipi). And you can make a normal POST/PUT to Knora instead of a special In any case, this will all be handled by a Salsah component, so users won't need to care about it. If Knora doesn't have to handle files itself, the advantage for Knora is that it takes load off the Knora server, simplifies the code (no need to deal with temporary files and |
I’m for sending files directly to SIPI (#535). |
Also, dasch-swiss/sipi#254 should allow Knora to have any information that it needs about a file. |
I understand Loïc‘s argument. From a user perspective it would be simpler. However we will have to provide tools (python modules, php modules, Angular etc.) that the user can & should use. These should hide the comlexity from the user totally.
Von meinem iPhone gesendet
Am 21.09.2018 um 13:05 schrieb Ivan Subotic <[email protected]<mailto:[email protected]>>:
Also, dasch-swiss/sipi#254<dasch-swiss/sipi#254> should allow Knora to have any information that it needs about a file.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#998 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFN9zB4NkciOytBz6iZX3FO6M5Iv7o-Gks5udMffgaJpZM4WyZXm>.
|
When I wrote the V1 integration Knora-Sipi, I wanted to make sure that the metadata stored by Knora (mimetype, original file name with extension) are checked by Sipi based on the submitted image file. For v2, this could be achieved by Knora asking Sipi about the metadata or the validity of user provided metadata after the upload to Sipi, but it should not be the client sending a request to Sipi first, then getting the metadata and then sending them to Knora. My rationale is that the DaSCH could be asked to recreate the original file format from JPEG2000. So we need to be sure that this information is actually correct. If someone submits a JPG file and claims it is a tiff, the request has to be rejected. When I speak about metadata, I mean the data stored with a file value in Knora. Probably by now some metadata is also stored in the JPEG 2000 itself. |
Can Sipi already do this? If not, would this require C++ code? Or just Lua code?
Currently when you log into Knora, you get a JWT token. But as far as I can see, Knora's Lua scripts for Sipi don't use it. How should we use a JWT token to authenticate a file upload? Just put it in the URL when posting the file to Sipi? |
@tobiasschweizer In the current GUI case, where the user submits the file directly to Sipi, how does Knora ensure that the file metadata is correct? |
I think we first have to make an exact description of the process - possibly of both variants. The description should include the flow of permission information, all metadata needed etc. I will make a draft - that is one for each variant - this weekend and post it on github
Von meinem iPhone gesendet
Am 21.09.2018 um 13:50 schrieb Benjamin Geer <[email protected]<mailto:[email protected]>>:
@tobiasschweizer<https://github.com/tobiasschweizer> In the current GUI case, where the user submits the file directly to Sipi, how does Knora ensure that the file metadata is correct?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub<#998 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFN9zCKcugd5CGgEErN7CmV6Lw121vhiks5udNKXgaJpZM4WyZXm>.
|
Hm, this might actually be missing from In https://github.com/dhlab-basel/Knora/blob/develop/sipi/scripts/convert_from_binaries.lua it works like this: |
Ah, now I remember: https://github.com/dhlab-basel/Knora/blob/develop/sipi/scripts/make_thumbnail.lua this is done first :-) |
But the client gets the response from |
It looks to me like even in the GUI case, |
If possible, I would like to be part of this discussion. Since I’m on vacation, I would suggest to postpone it to when I’m back. |
@tobiasschweizer and I talked about this, now it's clear what happens in the GUI case in API v1:
I think this is basically what should happen in API v2, whether or not the GUI is used. The only difference is that a GUI will want a thumbnail, but a non-GUI client doesn't need a thumbnail. Knora can get all the file's metadata from Sipi (as it does in API v1). The only thing it can't get from Sipi is the file's original filename, because Sipi doesn't store that. So the client has to give Knora the original filename, and Knora just needs to check that the file extension corresponds to the file's actual type (as determined by Sipi). |
That would be great.
No problem for me. |
It does, or at least the functionality is there, when Sipi used in the command line. |
It is returned in the |
OK that's good to know. |
Thanks 😀 |
After discussion with @lrosenth, our plan is:
If the files are not images, the same thing happens, except that there is no conversion to JPEG 2000 and no image dimensions. Currently,
It would be good to change Salsah 1.5 so that it doesn't need these anymore. Or we could change API v1 to provide simulated values for those properties. |
* feature (sipi): Add Lua code for uploading a file to Sipi as per #998 * refactor (api-v2): Refactor file value classes. - Remove deprecated properties isPreview and qualityLevel from API v2. * feature (api-v2): Implement file value creation (ongoing). * feature (api-v2): Implement file value creation (ongoing). * test (api-v2): Test creating and updating still image file values with mock Sipi. * feature (api-v2): Have Sipi move a temporary file to permanent storage (ongoing). - Fix broken tests. * feature (api-v2): Have Sipi move a temporary file to permanent storage (ongoing). * refactor (Authenticator): Start replacing deprecated JWT library (#1044). * refactor (Authenticator): Continue replacing deprecated JWT library (#1044). * refactor (Authenticator): Finish replacing deprecated JWT library (#1044). - Add more JWT tests. * feature (sipi): Improve Lua script for Sipi file upload (ongoing). - Delete old temporary files each time an upload is processed. - Fix incorrect log level names in Lua scripts. * feature (sipi): Validate JWT token in file upload. * feature (sipi): Improve JWT token validation. * test (api-v2): Add integration test for creating a file value with Sipi (ongoing). - Fix some bugs. - Fix broken authentication message package structure. * fix (sipi): Fix lots of Lua script bugs. - Improve error-handling in Lua scripts. - Fix test data for knora-api:fileValueAsUrl. * feature (api-v2): If a file value triplestore update fails, have Sipi delete the temp file (ongoing). * feature (sipi): Make SipiImage directly from uploaded file. - Take into account directory hashing in Lua scripts. - Recursively clean up temporary directory. - Clean up Lua scripts. * test (sipi): Test deleting temp file if file value creation fails. * test (sipi): Activate subdirs in temp dir for tests. * refactor (sipi): Use simple form of SipiImage.new. * test (api-v2): Add tests of file uploads. - Test creating a resource with a file value. - Test Knora's handling of Sipi errors. * test (sipi): Test creating a resource with multiple file values. - Fix upload.lua to preserve the order of uploaded files. - Give knora-api:stillImageFileValueHasIIIFBaseUrl a type of xsd:anyURI. - Fix test data. * feature (sipi): Have Sipi return original filename in response to upload. * docs (api-v2): Add API and design docs about file uploads. * docs (release-notes): Update release notes. * test (sipi): Use new login request format. * docs (api-v2): Add warning about #1068. * fix (api-v1): Adapt API v1 to ignore preview image file values in triplestore. - Update tests. * fix (sipi): Use a JPEG 2000 image to generate previews for testing. * feature (sipi): Clean up a few things. * test (api-v1): Test resource context response when there's no preview image in the triplestore.
How API v1 does this
SipiConstants
), so we need only the resource IRI and the file itself.Goals for API v2
Design
Akka HTTP can process a request with multiple files:
https://doc.akka.io/docs/akka-http/current/routing-dsl/directives/file-upload-directives/fileUploadAll.html
To authorise an upload in Sipi, I guess we're going to use JWT (#520)? How will this work in SALSAH?
The text was updated successfully, but these errors were encountered: