Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
AO3-5188 (BOT) Make downloads synchronous #3090
Conversation
zz9pzza
added
Awaiting review
Priority: Broken on Test (High)
labels
Oct 2, 2017
| @@ -92,7 +95,10 @@ def download_mobi | ||
| flash[:error] = ts('We were not able to render this work. Please try another format') | ||
| redirect_back_or_default work_path(@work) and return | ||
| end | ||
| - send_file("#{@work.download_basename}.mobi", type: "application/x-mobipocket-ebook") | ||
| + # send file synchronously so we don't delete it before we have finsihed sending it. | ||
| + File.open("#{@work.download_basename}.mobi", 'r') do |f| |
ariana-paris
changed the title from
AO3-5188 (BOT) Make things synchronous
to
AO3-5188 (BOT) Make downloads synchronous
Oct 2, 2017
| @@ -92,7 +99,7 @@ def download_mobi | ||
| flash[:error] = ts('We were not able to render this work. Please try another format') | ||
| redirect_back_or_default work_path(@work) and return | ||
| end | ||
| - send_file("#{@work.download_basename}.mobi", type: "application/x-mobipocket-ebook") | ||
| + send_file_sync("#{@work.download_basename}.mobi", "#{@work.download_title}.mobi", "application/x-mobipocket-ebook") |
| - title = Shellwords.escape(@work.title) | ||
| - author = Shellwords.escape(@work.display_authors) | ||
| - cmd_post = %Q{ --mobifile "#{@work.download_title}.mobi" --title #{title} --author #{author} } | ||
| + cmd_pre = %Q{cd "#{@work.download_dir}"; html2mobi } |
| + # metadata needs to be escaped for command line | ||
| + title = Shellwords.escape(@work.title) | ||
| + author = Shellwords.escape(@work.display_authors) | ||
| + cmd_post = %Q{ --mobifile "#{@work.download_title}.mobi" --title #{title} --author #{author} } |
elzj
merged commit 3a2d8de
into
otwcode:master
Oct 2, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zz9pzza commentedOct 2, 2017
Issue
https://otwarchive.atlassian.net/browse/AO3-*5188
Testing
Check the downloads work...