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

Can we remove the source_file from destination_name? #70

Open
tampakis opened this issue Aug 6, 2015 · 3 comments
Open

Can we remove the source_file from destination_name? #70

tampakis opened this issue Aug 6, 2015 · 3 comments

Comments

@tampakis
Copy link
Member

tampakis commented Aug 6, 2015

Is there any reason why destination_name needs to be a concatenation of source_file and derivative name when it gets set here?

I think it makes sense to have it just be the derivative name. The way this works now I have to strip out the source name in Hydra::Works.

@tampakis
Copy link
Member Author

tampakis commented Aug 6, 2015

For instance I think file.attached_files['thumb'] makes more sense than 'original_file_thumb'

@grosscol
Copy link
Member

grosscol commented Aug 6, 2015

It's a concatenation of source and name. Are there cases where a model would have multiple sources of derivative and they would have the same name here? For example: original_file_thumb and other_file_thumb. The path of both children would be the same if it weren't for the concat in that case.

We could attach name as original_name to the file object. I think original name is nil or blank currently for the derivatives, as it is not passed through as an option to add_file.

@grosscol
Copy link
Member

grosscol commented Aug 7, 2015

Looks like destination_name should remain with the source_file prefix even though that doesn't perfectly suit our current downstream use.

I'm going to create an issue to pass the name of the directive responsible for the derivative (e.g. thumbnail) as the original_name on the derivative file that gets emitted to output_file_service.call. That way you won't have to strip off the file_name that you passed in the first place with a call like obj.transform_file :original_file, thumbnail: { format: 'jpg', size: '338x493' }.

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

No branches or pull requests

2 participants