scientist-softserv / west-virginia-university

West Virginia University
0 stars 0 forks source link

Thumbnails for url identifiers #161

Closed kirkkwang closed 11 months ago

kirkkwang commented 11 months ago

Story

🐛 Fix URI identifiers and URI's without pdf

This commit will modify the lookup logic for the record based on the id instead of the identifier. The problem was because now that we are accepting url identifiers, the directories and filenames that are based of off identifiers are not valid for url identifiers because they contain invalid characters. Since ids are already sanitized for special characters, we will use those instead to make valid directory and file names.

Also in this commit we move the MIME type check logic into the GenerateThumbsJob so we can determine what type of file we are downloading prior to picking a thumbnail generator. Checking the MIME type is more durable than checking the string of the URI.

🐛 Move database calls out of the views

This commit will fix a bug where the id was saved as the identifier. Though not truly a bug but more of a misnomer, it however did affect URI identifiers because identifiers were not the same as the id in this case. This commit will also move the database calls from the views to the controller making it adhere closer to the MVC pattern.