mirror of
https://github.com/neocities/neocities.git
synced 2025-08-02 07:41:52 +02:00
api: add upload_hash for checking file hash before uploading
This commit is contained in:
parent
7d17202f39
commit
4a2926508e
3 changed files with 55 additions and 0 deletions
|
@ -1512,6 +1512,12 @@ class Site < Sequel::Model
|
|||
save_changes validate: false
|
||||
end
|
||||
|
||||
def sha1_hash_match?(path, sha1_hash)
|
||||
relative_path = scrubbed_path path
|
||||
site_file = site_files_dataset.where(path: relative_path, sha1_hash: sha1_hash).first
|
||||
!site_file.nil?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def store_file(path, uploaded, opts={})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue