5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 20:46:21 +00:00

fix: encontrar el blob para este servicio

This commit is contained in:
f 2023-03-25 15:34:47 -03:00
parent 8c0ae30d75
commit d026204497

View file

@ -24,7 +24,7 @@ module ActiveStorage
instrument :upload, key: key, checksum: checksum do instrument :upload, key: key, checksum: checksum do
unless exist?(key) unless exist?(key)
IO.copy_stream(io, make_path_for(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 end
ensure_integrity_of(key, checksum) if checksum ensure_integrity_of(key, checksum) if checksum
end end
@ -77,7 +77,7 @@ module ActiveStorage
# @param :key [String] # @param :key [String]
# @return [String] # @return [String]
def filename_for(key) 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? raise ArgumentError, "Filename for key #{key} is blank" if filename.blank?
end end
end end
@ -92,7 +92,11 @@ module ActiveStorage
# @return [Site] # @return [Site]
def 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 end
end end