现有项目使用ruby 2.3.1,并使用相关gem升级到3.0.1 (rails 6.1.4)。
将gem更新为"回形针";";kt-paperclip" .
我得到以下错误,而上传一个文档。错误:
[回曲针]试图链接/tmp/RackMultipart20210809-20058-nn1h6f.jpeg到/tmp/a87ff679a2f3e71d9181a67b7542122c20210809-20058-f12xva.jpeg[回形针]试图链接/tmp/a87ff679a2f3e71d9181a67b7542122c20210809-20058-f12xva.jpeg到/tmp/a87ff679a2f3e71d9181a67b7542122c20210809-20058-tr9ezt.jpeg[回形针]试图链接/tmp/a87ff679a2f3e71d9181a67b7542122c20210809-20058-f12xva.jpeg到/tmp/a87ff679a2f3e71d9181a67b7542122c20210809-20058-ddtnlx.jpeg[回形针]试图链接/tmp/a87ff679a2f3e71d9181a67b7542122c20210809-20058-f12xva.jpeg到/tmp/a87ff679a2f3e71d9181a67b7542122c20210809-20058-ux65dm.jpeg
以下是我现有的设置:
has_attached_file :file_local,
path: ":rails_root/public/system/:attachment/:id/:style/:basename.:extension",
url: "/system/:attachment/:id/:style/:basename.:extension"
has_attached_file :file,
processors: [:format_delegator],
path: ":configured_path",
whiny: false,
styles: {rectangle: ["1280x640#", :jpg],
narrow: ["640x", :jpg],
large: ["1980x", :jpg],
square: ["480x480#", :jpg],
thumbnail: ["1920x1080#", :jpg],
encoded: {output: "html5",
processors: [:transcoder]}},
default_url: :set_default_url,
storage: :s3,
url: SETTINGS[:amazon][:s3_alias_url],
s3_host_name: SETTINGS[:amazon][:host_name],
s3_host_alias: SETTINGS[:amazon][:cloudfront_host],
s3_permissions: :private,
s3_protocol: :https,
s3_region: SETTINGS[:amazon][:region],
s3_credentials: {
bucket: SETTINGS[:amazon][:bucket]
}
有谁知道,如何解决上述问题?我需要检查哪个配置来跟踪问题?
我不认为这是一个错误。回形针io_adapters/abstract_adapter。有link_or_copy_file函数的Rb文件在那个日志中。
def link_or_copy_file(src, dest)
begin
Paperclip.log("Trying to link #{src} to #{dest}")
FileUtils.ln(src, dest, force: true) # overwrite existing
rescue Errno::EXDEV, Errno::EPERM, Errno::ENOENT, Errno::EEXIST => e
Paperclip.log(
"Link failed with #{e.message}; copying link #{src} to #{dest}"
)
FileUtils.cp(src, dest)
end
@destination.close
@destination.open.binmode
end
这只是日志,文件正在上传到本地文件夹。