JPEG content_type must be image/jpeg

This commit is contained in:
Mark Felder 2020-10-13 10:37:24 -05:00
parent b738f70953
commit 40f3cdc030
24 changed files with 37 additions and 37 deletions

View file

@ -82,7 +82,7 @@ test "Disabled via config" do
Pleroma.Config.put([:instance, :cleanup_attachments], false)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -116,7 +116,7 @@ test "in subdirectories" do
Pleroma.Config.put([:instance, :cleanup_attachments], true)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -155,7 +155,7 @@ test "with dedupe enabled" do
File.mkdir_p!(uploads_dir)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -188,7 +188,7 @@ test "with objects that have legacy data.url attribute" do
Pleroma.Config.put([:instance, :cleanup_attachments], true)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -225,7 +225,7 @@ test "With custom base_url" do
Pleroma.Config.put([:instance, :cleanup_attachments], true)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -13,7 +13,7 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do
upload_file = %Upload{
name: "an… image.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg")
}

View file

@ -18,7 +18,7 @@ test "adds shasum" do
upload = %Upload{
name: "an… image.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}

View file

@ -16,7 +16,7 @@ test "apply exiftool filter" do
upload = %Pleroma.Upload{
name: "image_with_GPS_data.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/DSCN0010.jpg"),
tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg")
}

View file

@ -17,7 +17,7 @@ test "apply mogrify filter" do
upload = %Upload{
name: "an… image.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}

View file

@ -18,7 +18,7 @@ test "apply mogrify filter" do
upload = %Pleroma.Upload{
name: "an… image.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}

View file

@ -20,7 +20,7 @@ test "applies filters" do
upload = %Pleroma.Upload{
name: "an… image.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}

View file

@ -112,7 +112,7 @@ test "does not allow descriptions longer than the post limit" do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "image.jpg"
}

View file

@ -19,7 +19,7 @@ test "put file to local folder" do
file = %Pleroma.Upload{
name: "image.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: file_path,
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}
@ -38,7 +38,7 @@ test "deletes local file" do
file = %Pleroma.Upload{
name: "image.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: file_path,
tempfile: Path.absname("test/fixtures/image_tmp.jpg")
}

View file

@ -56,7 +56,7 @@ test "it returns path with bucket namespace when namespace is set" do
setup do
file_upload = %Pleroma.Upload{
name: "image-tet.jpg",
content_type: "image/jpg",
content_type: "image/jpeg",
path: "test_folder/image-tet.jpg",
tempfile: Path.absname("test/instance_static/add/shortcode.png")
}

View file

@ -1029,7 +1029,7 @@ test "returns reblogs for users for whom reblogs have not been muted" do
describe "uploading files" do
setup do
test_file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -56,7 +56,7 @@ test "it handles our own uploads" do
user = insert(:user)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -77,7 +77,7 @@ test "validates for a basic object with an attachment", %{
user: user
} do
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -98,7 +98,7 @@ test "validates for a basic object with an attachment in an array", %{
user: user
} do
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -119,7 +119,7 @@ test "validates for a basic object with an attachment but without content", %{
user: user
} do
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -100,7 +100,7 @@ test "it posts a chat message without content but with an attachment" do
recipient = insert(:user)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -380,7 +380,7 @@ test "gets an users media, excludes reblogs", %{conn: conn} do
other_user = insert(:user)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -14,7 +14,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do
setup do
image = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -74,7 +74,7 @@ test "/api/v2/media", %{conn: conn, user: user, image: image} do
setup %{user: actor} do
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -106,7 +106,7 @@ test "/api/v1/media/:id good request", %{conn: conn, object: object} do
setup %{user: actor} do
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -167,7 +167,7 @@ test "Get MRF reason when posting a status is rejected by one", %{conn: conn} do
test "posting an undefined status with an attachment", %{user: user, conn: conn} do
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -408,7 +408,7 @@ test "creates a scheduled activity with a media attachment", %{user: user, conn:
|> Kernel.<>("Z")
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -222,7 +222,7 @@ test "updates the user's name", %{conn: conn} do
test "updates the user's avatar", %{user: user, conn: conn} do
new_avatar = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -246,7 +246,7 @@ test "updates the user's avatar", %{user: user, conn: conn} do
test "updates the user's banner", %{user: user, conn: conn} do
new_header = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -265,7 +265,7 @@ test "updates the user's banner", %{user: user, conn: conn} do
test "updates the user's background", %{conn: conn, user: user} do
new_header = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -22,7 +22,7 @@ test "A scheduled activity with a media attachment" do
|> NaiveDateTime.to_iso8601()
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -105,7 +105,7 @@ test "it fails if there is no content", %{conn: conn, user: user} do
test "it works with an attachment", %{conn: conn, user: user} do
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -24,7 +24,7 @@ test "mascot upload" do
assert json_response_and_validate_schema(ret_conn, 415)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}
@ -48,7 +48,7 @@ test "mascot retrieving" do
# When a user sets their mascot, we should get that back
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -19,7 +19,7 @@ test "it displays a chat message" do
recipient = insert(:user)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}

View file

@ -11,7 +11,7 @@ defp upload_file(context) do
File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg")
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image_tmp.jpg"),
filename: "nice_tf.jpg"
}

View file

@ -219,7 +219,7 @@ test "builds content for chat messages with no content" do
recipient = insert(:user)
file = %Plug.Upload{
content_type: "image/jpg",
content_type: "image/jpeg",
path: Path.absname("test/fixtures/image.jpg"),
filename: "an_image.jpg"
}