k10a
k10a

Reputation: 1087

Can't upload blob URL to Active Storage (ActiveSupport::MessageVerifier::InvalidSignature)

I would like to store data taken on the web in Active Storage in Rails. However, the data is not saved properly and I get an error in video_tag.

I have succeeded in creating the Blob data, but I have not been able to upload it.

Error

ActiveSupport::MessageVerifier::InvalidSignature

<%= f.hidden_field :media, id: "download-video" %>

// => <input id="download-video" type="hidden" value="blob:http://localhost:3000/859031b4-022b-4e7e-be08-518c77e8e9d1" name="post[media]">

app/models/post.rb

class Post < ApplicationRecord
  belongs_to :user
  has_one_attached :media
end

app/models/posts_controller.rb

---
def create
  @post = current_user.posts.create(create_params)
  @post.save
end
---

Upvotes: 0

Views: 701

Answers (1)

Maciej Pankanin
Maciej Pankanin

Reputation: 48

As long as I understand what you what to do you cannot do it like this.

Note that sending form with input value set to some URL will send string to the server but it is expecting file.

One solution would be downloading the file before creating Post in controller.

Similar problem

Upvotes: 1

Related Questions