arreglos a la subida de archivos

This commit is contained in:
f 2021-02-23 19:16:58 -03:00
parent c050d861bf
commit 1ae226bb3a
2 changed files with 9 additions and 1 deletions

View file

@ -123,10 +123,18 @@ class MetadataFile < MetadataTemplate
# #
# @return [Boolean] # @return [Boolean]
def hardlink def hardlink
return true if hardlink?
FileUtils.mkdir_p(File.dirname(destination_path)) FileUtils.mkdir_p(File.dirname(destination_path))
FileUtils.ln(uploaded_path, destination_path).zero? FileUtils.ln(uploaded_path, destination_path).zero?
end end
def hardlink?
File.stat(uploaded_path).ino == File.stat(destination_path).ino
rescue Errno::ENOENT
false
end
# Obtener la ruta al archivo # Obtener la ruta al archivo
# https://stackoverflow.com/a/53908358 # https://stackoverflow.com/a/53908358
def uploaded_relative_path def uploaded_relative_path

View file

@ -1,5 +1,5 @@
.form-group .form-group
- if metadata.uploaded? - if metadata.static_file
= hidden_field_tag "#{base}[#{attribute}][path]", metadata.value['path'] = hidden_field_tag "#{base}[#{attribute}][path]", metadata.value['path']
- case metadata.static_file.blob.content_type - case metadata.static_file.blob.content_type