Skip to content
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

feat: allow user to change fileinfo in callbacks #734

Conversation

halconel
Copy link

@halconel halconel commented May 23, 2022

#goal allow user to change file info in callbacks
In my case, I use this in order to be able to independently generate Upload.ID
which allow me to change folder in s3 store

Example:

	handler, err := tusd.NewUnroutedHandler(tusd.Config{
		BasePath:                "api/v1/files/",
		StoreComposer:           composer,
		NotifyCreatedUploads:    true,
		NotifyUploadProgress:    true,
		NotifyTerminatedUploads: true,
		NotifyCompleteUploads:   true,
		PreUploadCreateCallback: defineFolders,
	})
	if err != nil {
		panic(fmt.Errorf("Unable to create handler: %s", err))
	}
// defines path and key id for new upload
// {some}/{path}/{uid}
func defineFolders(hook *tusd.CallbackEvent) error {
	folder := "folder_example"
	hook.Upload.ID = fmt.Sprintf("%s/%s", folder, uid())

	return nil
}

@Acconut
Copy link
Member

Acconut commented Jun 17, 2022

Thank you for this PR, but I don't think approach is the optimal. As laid out in #685, we have plans to allow users to change the location of files. However, we want to implement this using the hook system that will be launched in tus v2.

@Acconut Acconut closed this Jun 17, 2022
@sdhull
Copy link

sdhull commented Jul 6, 2022

@Acconut can you give us any insight into roadmap or timeline? I see you closed this and #685—it's likely we'll end up using one of these forks (or our own similar work) in production if there isn't a better solution available soon.

Is there somewhere you've outlined the work that needs to happen? Are there tickets we could help with that would expedite v2?

@Acconut
Copy link
Member

Acconut commented Jul 16, 2022

@sdhull We unfortunately do not have any concrete dates or ETAs available. I know it is frustrating to see PRs like this being closed when no other option is available yet. However, we would like to implement such features in a proper manner, even if this takes time. I hope you understand this.

If you feel the need, to switch to one of these forks, feel free too. You can always switch back to the mainline tusd version. But please be aware that we are obviously not maintaining them :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants