Merge pull request #1736 from billbitt/fix-spee.ch-thumbnail-publish
changed form data to attach a File rather than Blob
This commit is contained in:
commit
2ae75b8a38
1 changed files with 3 additions and 2 deletions
|
@ -74,6 +74,7 @@ export const doResetThumbnailStatus = () => (dispatch: Dispatch): PromiseAction
|
||||||
export const doUploadThumbnail = (filePath: string, nsfw: boolean) => (dispatch: Dispatch) => {
|
export const doUploadThumbnail = (filePath: string, nsfw: boolean) => (dispatch: Dispatch) => {
|
||||||
const thumbnail = fs.readFileSync(filePath);
|
const thumbnail = fs.readFileSync(filePath);
|
||||||
const fileExt = path.extname(filePath);
|
const fileExt = path.extname(filePath);
|
||||||
|
const fileName = path.basename(filePath);
|
||||||
|
|
||||||
const makeid = () => {
|
const makeid = () => {
|
||||||
let text = '';
|
let text = '';
|
||||||
|
@ -100,9 +101,9 @@ export const doUploadThumbnail = (filePath: string, nsfw: boolean) => (dispatch:
|
||||||
|
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
const name = makeid();
|
const name = makeid();
|
||||||
const blob = new Blob([thumbnail], { type: `image/${fileExt.slice(1)}` });
|
const file = new File([thumbnail], fileName, { type: `image/${fileExt.slice(1)}` });
|
||||||
data.append('name', name);
|
data.append('name', name);
|
||||||
data.append('file', blob);
|
data.append('file', file);
|
||||||
data.append('nsfw', nsfw.toString());
|
data.append('nsfw', nsfw.toString());
|
||||||
return fetch('https://spee.ch/api/claim/publish', {
|
return fetch('https://spee.ch/api/claim/publish', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
Loading…
Add table
Reference in a new issue