File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -222,17 +222,17 @@ task remote_genbook2: :environment do
222
222
223
223
begin
224
224
rel = @octokit . latest_release ( repo )
225
- get_url = -> ( content_type ) do
226
- asset = rel . assets . find { |asset | asset . content_type == content_type }
225
+ get_url = -> ( name_re ) do
226
+ asset = rel . assets . find { |asset | name_re . match ( asset . name ) }
227
227
if asset
228
228
asset . browser_download_url
229
229
else
230
230
nil
231
231
end
232
232
end
233
- book . ebook_pdf = get_url . call ( "application/ pdf" )
234
- book . ebook_epub = get_url . call ( "application/ epub+zip" )
235
- book . ebook_mobi = get_url . call ( "application/x-mobipocket-ebook" )
233
+ book . ebook_pdf = get_url . call ( / \. pdf$/ )
234
+ book . ebook_epub = get_url . call ( / \. epub$/ )
235
+ book . ebook_mobi = get_url . call ( / \. mobi$/ )
236
236
rescue Octokit ::NotFound
237
237
book . ebook_pdf = nil
238
238
book . ebook_epub = nil
You can’t perform that action at this time.
0 commit comments