storage manager: remove original_subdir option.

Always store original files in `public/data/original` instead of directly in
`public/data`. Previously this was optional and defaulted to off.

Downstream boorus will need to either move all images in the
`public/data` directory to `public/data/original`, or symlink the
`public/data/original` directory to the toplevel `public/data` directory:

    ln -s . /path/to/danbooru/public/data/original

This to simplify file layout. This option existed because in the past we
stored original files in different locations on different servers (for
no particular reason).
This commit is contained in:
evazion
2021-03-15 02:07:10 -05:00
parent 0f90ae0fed
commit a620a71b59
2 changed files with 4 additions and 17 deletions

View File

@@ -124,18 +124,6 @@ class StorageManagerTest < ActiveSupport::TestCase
assert_equal("http://localhost/images/download-preview.png", @storage_manager.file_url(@post, :preview))
end
end
context "when the original_subdir option is used" do
should "store original files at the correct path" do
@post = FactoryBot.create(:post, file_ext: "png")
@storage_manager = StorageManager::Local.new(base_dir: @temp_dir, base_url: "/data", original_subdir: "original/")
assert_equal("#{@temp_dir}/original/#{@post.md5}.png", @storage_manager.file_path(@post, @post.file_ext, :original))
@storage_manager.store_file(StringIO.new("data"), @post, :original)
assert_equal(true, File.exist?("#{@temp_dir}/original/#{@post.md5}.png"))
end
end
end
context "StorageManager::Hybrid" do