Custom Prefix Will Fail If Token Does Not Have a Custom Prefix
Opened this issue · 1 comments
skng5 commented
This returns nil if the provider is not UPENN.
https://github.com/tulibraries/dplah/blob/develop/lib/thumbnail_utils.rb#L138-L149
The define_thumbnail_pattern
method will throw an error because it changes the the token1
string to nil.
Lines 92 to 96 in cfe9b0c
skng5 commented
Something like this may work better:
def custom_thumbnail_prefixing(token, provider)
case provider.endpoint_url
when "http://dla.library.upenn.edu/dla/wheeler/oai-pmh.xml"
token = token.gsub("WHEELER_","wheeler_")
when "http://dla.library.upenn.edu/dla/holyland/oai-pmh.xml"
token = token.gsub("HOLYLAND_","")
when "http://dla.library.upenn.edu/dla/archives/oai-pmh.xml"
token = token.gsub("ARCHIVES_","archives_")
else
token
end
end