Vi är två bröder som båda studerat till civilingenjörer med ett stort intresse för teknik, mjukvara och entreprenörskap.


  • Published on

    Error when converting PDF to image on Github Actions

    MiniMagick::Error: `convert /tmp/shrine20201009-22018-5itpj9.pdf[0] -auto-orient /tmp/image_processing20201009-22018-1uk39lv.png` failed with error:
    convert-im6.q16: not authorized `/tmp/shrine20201009-22018-5itpj9.pdf' @ error/constitute.c/ReadImage/412.
    convert-im6.q16: no images defined `/tmp/image_processing20201009-22018-1uk39lv.png' @ error/convert.c/ConvertImageCommand/3258.
        app/uploaders/document_uploader.rb:13:in `block in <class:DocumentUploader>'
        test/jobs/documents/documents_upload_job_test.rb:8:in `block in <class:UploadJobTest>'

    In my Ruby on Rails application, this error is raised when using MiniMagick to convert a PDF into an image. MiniMagick uses ImageMagick which uses Ghostscript for anything related to postscript files - for example PDFs.

    Due to a security vulnerability in Ghostscript < 9.24, ImageMagick changed the default policy to not allow conversions using Ghostscript. Even if Ghostscript has fixed the vulnerability, the ImageMagick policy has not been changed.

  • Published on

    Rails - Minitest results output in TAP-format for Heroku CI

    Originally posted on my DEV.to page.

    When using Heroku CI for automatic testing, the default output is just pass or fail without any parsing of how many tests passed or what errors where found.

    This can be improved if you output the results in the Test Anything Protocol-format (TAP-format) according to Heroku.

    This format is not built into the test frameworks used in Ruby on Rails. Therefore I had to write my own test reporter.