mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: Can't use an internal name here if SiteSetting.convert_pasted_images_to_hq_jpg
is false
.
This commit is contained in:
@ -170,7 +170,7 @@ export function validateUploadedFiles(files, opts) {
|
|||||||
|
|
||||||
// CHROME ONLY: if the image was pasted, sets its name to a default one
|
// CHROME ONLY: if the image was pasted, sets its name to a default one
|
||||||
if (typeof Blob !== "undefined" && typeof File !== "undefined") {
|
if (typeof Blob !== "undefined" && typeof File !== "undefined") {
|
||||||
if (upload instanceof Blob && !(upload instanceof File) && upload.type === "image/png") { upload.name = "__blob__.png"; }
|
if (upload instanceof Blob && !(upload instanceof File) && upload.type === "image/png") { upload.name = "image.png"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
@ -74,7 +74,7 @@ class UploadsController < ApplicationController
|
|||||||
return { errors: I18n.t("upload.file_missing") } if tempfile.nil?
|
return { errors: I18n.t("upload.file_missing") } if tempfile.nil?
|
||||||
|
|
||||||
# convert pasted images to HQ jpegs
|
# convert pasted images to HQ jpegs
|
||||||
if filename == "__blob__.png" && SiteSetting.convert_pasted_images_to_hq_jpg
|
if filename == "image.png" && SiteSetting.convert_pasted_images_to_hq_jpg
|
||||||
jpeg_path = "#{File.dirname(tempfile.path)}/image.jpg"
|
jpeg_path = "#{File.dirname(tempfile.path)}/image.jpg"
|
||||||
OptimizedImage.ensure_safe_paths!(tempfile.path, jpeg_path)
|
OptimizedImage.ensure_safe_paths!(tempfile.path, jpeg_path)
|
||||||
`convert #{tempfile.path} -quality #{SiteSetting.convert_pasted_images_quality} #{jpeg_path}`
|
`convert #{tempfile.path} -quality #{SiteSetting.convert_pasted_images_quality} #{jpeg_path}`
|
||||||
|
Reference in New Issue
Block a user