Skip to content

Instantly share code, notes, and snippets.

@ashikajith
Created August 9, 2019 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ashikajith/1bfe54e1e6370696d2dbe3c0fc81de8c to your computer and use it in GitHub Desktop.
Save ashikajith/1bfe54e1e6370696d2dbe3c0fc81de8c to your computer and use it in GitHub Desktop.
Masking S3 URL

S3 Masking URL

For masking the url we created a seperate routes, controller to fetch the record and generate the url for the download file.

  app/controllers/ubiquity/fail_uploads_controller.rb
  
  def download_file
    params[:fileset_id]
    uuid = params[:uuid]
    s3_file_set_url = Ubiquity::ImporterClient.get_s3_url uuid
    url = s3_file_set_url.file_url_hash[params[:fileset_id]]
    redirect_to url
  end

We will be passing the File Set ID and the Work UUID to fetch the s3 url from the remote api server. Once we trigger the api we will get the corresponding s3 url for the specific file and we'll redirect to that particular url to download the file from s3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment