-
Notifications
You must be signed in to change notification settings - Fork 102
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
Reduce implications of Location header field. #30
Comments
Is your typical use case TUS Upload server for receiving uploads and finally archiving in S3 or something equivalent? Can you not implement a simple redirect /files/id to permanent storage? Correct me if I am wrong. You want it be more like upload_id similar to google cloud storage resumable api or s3 multipart api? |
By TUS Upload server do you mean the reference implementation / php-tus? If so: No, I thought about implementing it directly, as the php variant depends on
The mentioned bundle supports the usage of Gaufrette, a filesystem abstraction layer. This is why I can't predict the used storage backend, so archiving on a S3 lies within the possibilities.
An upload server should be storage agnostic IMHO, so you can easily change the type of storage when you need to. I could force the user to map
This is correct. I'm not saying it could not be an accessible route or an url if you like. All I asked myself was: Why force the upload server to have an url/route in the first place and before the file completely uploaded? Ah. I have probably found the source of my confusion. According to #28 the file retrieval strategy is still in discussion. However, the problem naming the file still persists. I think there should be a way of telling the client the location of a fully uploaded file, once the upload process is completed. This way, you could easily determine MIME types server side and name the file accordingly. And as a positive side effect, you would not have to implement a redirect from the temporary directory to the chosen storage layer. |
There are two possibilities here:
I am not sure if this should be part of TUS spec. dropbox api has something similar. Client specifies final file location
Upload server generates final file location
It is not perfect. The other option is to have an additional Client specifies final location
Upload server specifies final location
Also it is tricky for large files. Consider a situation a file is being transferred to final location. We should probably return another header
upon transfer complete
Doesn't look elegant. You might have thought through this already. I am open to suggestions. |
I'd rather not assume any client to be intelligent in any other way than supporting the basic protocol.
That's in my opinion the way to go. I'd imagine a possible conversation like this:
I don't see the need that a client specifies an
The The last
And of course the servers response.
The only thing that changes to the current version of the protocol is the last response from the server, where either an additional (but optional) Furthermore, this behaviour would not break backward compatibility. What do you think, could this be a possibility? |
It as a valid scenario. The API clients may decide to save it in a specific bucket/filepath similar to S3.
Adding to location to final |
Yes. That's necessary for remote filesystems like S3. But if your permanent storage is the same (local) filesystem than the temporary one (but different folders), you don't have to move a file the classical way. A simple rename does the same in no time.
You're right, sorry. I was just thinking of frontend uploaders. Taking APIs into consideration, the protocol design makes perfectly sense. Maybe I'll just implement it the way you mentioned previously. Link the id to the actual file and implement some kind of expiration policy for the id, like the one mentioned here. Do you mind if I leave this issue open for the time I'm implementing the protocol? Maybe I spot some more possibilities during this process. |
Sounds good to me. |
I agree.
Any update on this? We have discussed handling filenames already (see #38) although this may be be exactly the same problem as the one you have. |
I'm glad to see such projects in the wild. Uploading files was a complete mess until now. :)
I considered implementing this protocol to the Symfony2 bundle OneupUploaderBundle and stumbled over the following part of the specification.
See section 6.1.3.1 for details.
This has multiple severe implications on application backends that support tus.
Location
header that is an absolute url for the created resource assumes that there is always a public url for an uploaded file. Even though possible use-cases might be edge cases, I don't think a protocol should enforce such behavior.Given the fact that there must be a valid identifier which can be sent along in subsequent requests, I can think of the following possibility:
Do not enforce an accessible url for the created resource in the following requests:
Think of
24e533e02ec3bc40c387f1a0e460e216
as an identifier rather than a file name.And extend the last response from the backend by a
Location
field to send an accessible url to the client. (This could be optional given the fact that there might be none.RECOMMENDED
orOPTIONAL
)This way it is possible to name the file after the last uploaded bytes and move it from a temporary directory to its final place.
What do you think? Would this be a reasonable way to go, or am I missing something (maybe I misunderstand the specification at this point)?
cc 1up-lab/OneupUploaderBundle#52
The text was updated successfully, but these errors were encountered: