Giter Site home page Giter Site logo

Comments (9)

smatsson avatar smatsson commented on June 12, 2024 1

@Acconut

The server can always add additional metadata to the upload that the client can fetch using a HEAD request. Using that workaround that is already possible.

Should we clarify this in the spec? The only mention of client/server that I can find right now is this which gives the impression that only the client can supply metadata.

The Client MAY supply the Upload-Metadata header to add additional metadata to the upload creation request. The Server MAY decide to ignore or use this information to further process the request or to reject it. If an upload contains additional metadata, responses to HEAD requests MUST include the Upload-Metadata header and its value as specified by the Client during the creation.

from tus-resumable-upload-protocol.

smatsson avatar smatsson commented on June 12, 2024 1

@Acconut I think it's a fair trade off so I'll just skip the PR for clarifying the spec and leave it to the upcoming post processing extension.

from tus-resumable-upload-protocol.

Acconut avatar Acconut commented on June 12, 2024

Thanks for the kind words!

the server does some post processing after uploading to add some metadata (think things like image dimensions, exif data, video length, etc)

The server can always add additional metadata to the upload that the client can fetch using a HEAD request. Using that workaround that is already possible.

client's don't seem to expose the final server response in order to extract information like this

That depends on the clients, of course. tus-js-client, for example, allows to obtain the responses from the server to inspect them for additional data.

Would a maintainer accept an extension to the protocol to allow for such server-based postprocessing?

We're always open a discussion, yes. You might also want to look into #159 where the topic of post-processing also appears.

from tus-resumable-upload-protocol.

rockwotj avatar rockwotj commented on June 12, 2024

The server can always add additional metadata to the upload that the client can fetch using a HEAD request. Using that workaround that is already possible.

This means it has to be a header yes? We have just enough metadata I'm not super comfortable sticking it in a header, because certain proxies have limits on how long headers can be (I believe NGINX is such an example), but I guess we could break it up between lots of different headers, which may work... Or I guess I could return a 200 from a PATCH request (instead of the 204 tusd responds with) and set the metadata there on the final upload.

We're always open a discussion, yes. You might also want to look into #159 where the topic of post-processing also appears.

I'll hop into that discussion and see if I can be helpful.

from tus-resumable-upload-protocol.

Acconut avatar Acconut commented on June 12, 2024

This means it has to be a header yes?

Yes, metadata is transported using the Upload-Metadata header.

I'll hop into that discussion and see if I can be helpful.

👍

from tus-resumable-upload-protocol.

Acconut avatar Acconut commented on June 12, 2024

Should we clarify this in the spec? The only mention of client/server that I can find right now is this which gives the impression that only the client can supply metadata.

Good point, yes we should do that!

from tus-resumable-upload-protocol.

smatsson avatar smatsson commented on June 12, 2024

After reading the spec a couple of more times, I'm wondering if the server can actually change the metadata? It seems that this is explicitly forbidden in the current spec:

The Client MAY supply the Upload-Metadata header to add additional metadata to the
upload creation request. The Server MAY decide to ignore or use this information to
further process the request or to reject it. If an upload contains additional
metadata, responses to HEAD requests MUST include the Upload-Metadata header
and its value as specified by the Client during the creation.

"As specified by the Client during the creation" being the key part. If the Server changes the metadata it is no longer "as specified by the Client" unless the Server's changes are not included in the HEAD response. But then again, the Client can't access it. Any input @Acconut?

from tus-resumable-upload-protocol.

RubenGarcia avatar RubenGarcia commented on June 12, 2024

I would have expected that after a successful upload, the server would send a Location header. Then the client could use this Location header to inquire about relevent metadata, possibly at a different endpoint, as this additional metadata looks to me to be outside of the tus protocol. For example: "Location https://service/uploads/path" -> "GET https://service/metadata?location=uploads/path"

from tus-resumable-upload-protocol.

Acconut avatar Acconut commented on June 12, 2024

@smatsson: After reading the spec a couple of more times, I'm wondering if the server can actually change the metadata? It seems that this is explicitly forbidden in the current spec

You are right, I forgot about that wording. IIRC, we added this sentence so that servers cannot change metadata keys that were sent by the client. For example, the client sets filename hello.txt and the server later responds with filename hello.TXT. From this perspective my last comments are wrong and the current metadata system cannot be used to send values back to the client.

@RubenGarcia I would have expected that after a successful upload, the server would send a Location header. Then the client could use this Location header to inquire about relevent metadata, possibly at a different endpoint, as this additional metadata looks to me to be outside of the tus protocol.

This would also be a possible approach we have thought about. Maybe you want to take a look at the discussion at #159 and especially the comment at #159 (comment).

from tus-resumable-upload-protocol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.