Created
March 8, 2016 17:04
-
-
Save krishan/114905ceeb29708fe9bc to your computer and use it in GitHub Desktop.
Hotfix for Timeout Error during Uploads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # put this into config/initializers/scrivito_monkey_patch.rb | |
| scrivito_version = Gem.loaded_specs["scrivito"].version | |
| scrivito_gem_version = Gem::Version.new(scrivito_version) | |
| checked_versions = [">= 0.71.0", "< 1.3.0"] | |
| blob_render_versions = [">= 1.2.0.rc1"] | |
| $_scrivito_does_blob_render = | |
| Gem::Requirement.new(blob_render_versions).satisfied_by?(scrivito_gem_version) | |
| requirement = Gem::Requirement.new(checked_versions) | |
| if !requirement.satisfied_by?(scrivito_gem_version) | |
| raise "this monkey patch was designed for scrivito versions #{checked_versions}. "\ | |
| "you upgraded scrivito to #{scrivito_version}, please ensure it still applies and works" | |
| end | |
| # ensure the target class has been loaded | |
| Scrivito::BlobsController | |
| module Scrivito | |
| class BlobsController < WebserviceController | |
| def activate_upload | |
| @blob = CmsRestApi.task_unaware_request( | |
| :put, | |
| 'blobs/activate_upload', | |
| params.slice(:upload, :obj_id, :filename, :content_type) | |
| ) | |
| if $_scrivito_does_blob_render | |
| render :blob | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment