mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 14:21: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
|
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
|
||||||
|
|
Loading…
Reference in a new issue