FIX: Properly support defaults for upload site settings.

This commit is contained in:
Guo Xiang Tan
2019-01-02 15:29:17 +08:00
parent 684eef71c7
commit b0c8fdd7da
26 changed files with 170 additions and 151 deletions

View File

@ -92,10 +92,6 @@ module FileStore
def purge_tombstone(grace_period)
end
def get_depth_for(id)
[0, Math.log(id / 1_000.0, 16).ceil].max
end
def get_path_for(type, id, sha, extension)
depth = get_depth_for(id)
tree = File.join(*sha[0, depth].chars, "")
@ -148,6 +144,12 @@ module FileStore
raise "Not implemented."
end
def get_depth_for(id)
depths = [0]
depths << Math.log(id / 1_000.0, 16).ceil if id.positive?
depths.max
end
end
end