mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 14:41:41 +00:00
fix: encontrar el blob para este servicio
This commit is contained in:
parent
2940b5d3e8
commit
2fb5bc24d5
1 changed files with 7 additions and 3 deletions
|
@ -24,7 +24,7 @@ module ActiveStorage
|
|||
instrument :upload, key: key, checksum: checksum do
|
||||
unless exist?(key)
|
||||
IO.copy_stream(io, make_path_for(key))
|
||||
LfsObjectService.new(site: site, blob: blob).process
|
||||
LfsObjectService.new(site: site, blob: blob_for(key)).process
|
||||
end
|
||||
ensure_integrity_of(key, checksum) if checksum
|
||||
end
|
||||
|
@ -77,7 +77,7 @@ module ActiveStorage
|
|||
# @param :key [String]
|
||||
# @return [String]
|
||||
def filename_for(key)
|
||||
ActiveStorage::Blob.where(key: key).limit(1).pluck(:filename).first.tap do |filename|
|
||||
blob_for(key).filename.to_s.tap do |filename|
|
||||
raise ArgumentError, "Filename for key #{key} is blank" if filename.blank?
|
||||
end
|
||||
end
|
||||
|
@ -92,7 +92,11 @@ module ActiveStorage
|
|||
|
||||
# @return [Site]
|
||||
def site
|
||||
@site ||= Site.find_by_name(File.basename(root))
|
||||
@site ||= Site.find_by_name(name)
|
||||
end
|
||||
|
||||
def blob_for(key)
|
||||
ActiveStorage::Blob.find_by(key: key, service_name: name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue