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

Storage adapters should have #id_for #887

Open
tpendragon opened this issue Dec 17, 2021 · 2 comments · May be fixed by #914
Open

Storage adapters should have #id_for #887

tpendragon opened this issue Dec 17, 2021 · 2 comments · May be fixed by #914

Comments

@tpendragon
Copy link
Collaborator

This should take the same parameters as #upload, but just return the ID that it would build when it's done.

Useful when you're not storing the resulting ID, and need to re-calculate it so you can find the file again.

@dunn
Copy link
Collaborator

dunn commented Oct 19, 2022

would this just be #upload but with the file moving removed? so something like

    def id_for(file:, original_filename:, resource: nil, **_extra_arguments)
      new_path = path_generator.generate(resource: resource, file: file, original_filename: original_filename)
      # FileUtils.mkdir_p(new_path.parent)
      # file_mover.call(file.path, new_path)
      # find_by(id: Valkyrie::ID.new("disk://#{new_path}"))
      Valkyrie::ID.new("disk://#{new_path}")
    end

@tpendragon
Copy link
Collaborator Author

Yeah that makes sense to me.

dunn added a commit that referenced this issue Oct 20, 2022
@dunn dunn linked a pull request Oct 20, 2022 that will close this issue
dunn added a commit that referenced this issue Oct 20, 2022
dunn added a commit that referenced this issue Oct 28, 2022
dunn added a commit that referenced this issue Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

2 participants