Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1277 from Kamuso/dev/v6-upload
Browse files Browse the repository at this point in the history
upload: don't mask image.png
  • Loading branch information
bakape committed Apr 10, 2021
2 parents b00e7d8 + b2c79ef commit 0125709
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/posts/posting/paste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function onPaste(e: ClipboardEvent) {
return
}

files[0]["pasted"] = true;
if (threadForm) {
(threadForm.querySelector("input[type=file]") as any).files = files
return
Expand Down
7 changes: 6 additions & 1 deletion client/posts/posting/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ export default class UploadForm extends View<Post> {
// the file thumbnailed and we don't need to upload.
const sha1 = await getSHA(file);
if (sha1 !== "") {
if (this.inputElement("mask").checked) {
// Don't mask pasted files
if (this.inputElement("mask").checked && file["pasted"] != true) {
uploadName = sha1;
}
const res = await fetch("/api/upload-hash", {
Expand Down Expand Up @@ -383,6 +384,10 @@ async function maskFile(input: HTMLInputElement) {
if (input.files.length === 0) {
return;
}
// Don't mask pasted files
if (input.files[0]["pasted"] == true) {
return;
}
// File.name is immutable, replace contents of input element
// with cloned+renamed file
const blob = input.files[0];
Expand Down

0 comments on commit 0125709

Please sign in to comment.