imagekit-developer / imagekit-developer/imagekit-ruby
How to migrate files from local persistent storage with CarrierWave correctly?
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Ruby
- Star
- 19
- Fork
- 8
- Merge trung bình
- 47 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
Initially, the application used local persistent storage. I tried moving the entire uploads directory into ImageKit. I kept the previous configuration and added a new one from ImageKit:
class BaseUploader < CarrierWave::Uploader::Base
include ImageKitIo::CarrierWave
def store_dir
full_file_path
end
# ...
def options
{
response_fields: "isPrivateFile, tags",
tags: %w[images],
use_unique_file_name: false,
folder: full_file_path
}
end
private
# ...
def full_file_path
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{dirs}"
end
# ...
end
As a result I get this error:
unexpected token at 'f1843b5f9.jpg'
From this line:
= image_tag band.card_image.url
In this case, the full name of the file in the database is: 9757131f1843b5f9.jpg.
Please tell me what else needs to be done to migrate files?
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với cấu hình BaseUploader và lời gọi image_tag band.card_image.url được nêu trong issue. Tái hiện lỗi bằng tên tệp cơ sở dữ liệu hiện có và xem tài liệu về quá trình di chuyển CarrierWave/ImageKit cũng như việc xử lý URL; được xem là hoàn tất khi các tệp đã di chuyển có thể được phân giải và render mà không gặp lỗi đã báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- ruby
- Lĩnh vực
- backend, cloud
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100