-
Notifications
You must be signed in to change notification settings - Fork 112
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
Attempt to return metadata after a TUS PATCH #797
Conversation
PVince81
commented
Jun 3, 2020
- PROBLEM: how to get at the actual file name, need to read the upload info file
- PROBLEM: cannot return headers as tusd is already sending the response
This won't work because the writeHeader method flushes the cache. But we could wrap the |
w.ResponseWriter.WriteHeader(w.statusCode) | ||
} | ||
|
||
func (w *WrappedResponseWriter) Header() http.Header { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method WrappedResponseWriter.Header should have comment or be unexported
// delay this | ||
} | ||
|
||
func (w *WrappedResponseWriter) SendResponse() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method WrappedResponseWriter.SendResponse should have comment or be unexported
statusCode int | ||
} | ||
|
||
func (w *WrappedResponseWriter) WriteHeader(statusCode int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method WrappedResponseWriter.WriteHeader should have comment or be unexported
@@ -48,6 +52,28 @@ type svc struct { | |||
storage storage.FS | |||
} | |||
|
|||
type WrappedResponseWriter struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type WrappedResponseWriter should have comment or be unexported
I've pushed an attempt to wrap the response. It works and I'm able to add headers after the TUS handler now. The next challenge is finding the path to pass to the CS3 API's And then I get a structure like this:
but I haven't figured out how to resolve the correct path reference to pass the the CS3 API. @butonic any hints ? |
@labkode sounds good. Note that this is mostly driven by client development, as the old protocol had these fields returned at the end of the upload to avoid having to do subsequent calls (which are tricky for example on iOS) |
I've been through TUS and started refactoring code in #828. Upon this task I've found a fundamental problem on the various implementations of TUS for the storages. By extending the interface with the For example, if your filesystem exposes to the storage provider the path So, the current implementations need to store the upload information under the configured root, that will allow to call GetMD and avoid that hack for example. Passing internal implementation details to upper layers is a no-go. |
won't be continued here |