summaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2020-01-02 02:45:05 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2020-01-02 02:45:05 +0900
commit78ef0a9929a1a4460acdca4f1810f8c0ca08f37f (patch)
treebc4f5c22fcebab69de20ce097f92f1625e2c62a2 /src/services
parent期限切れ/未保存リモートファイルのローカルプロキシ (#5... (diff)
downloadmisskey-78ef0a9929a1a4460acdca4f1810f8c0ca08f37f.tar.gz
misskey-78ef0a9929a1a4460acdca4f1810f8c0ca08f37f.tar.bz2
misskey-78ef0a9929a1a4460acdca4f1810f8c0ca08f37f.zip
ドライブファイルURL生成などの修正 (#5671)
* Fix: リモートプロキシ時にサムネイルのContent-Typeがおかしい * fix drive
Diffstat (limited to 'src/services')
-rw-r--r--src/services/drive/add-file.ts14
-rw-r--r--src/services/drive/delete-file.ts4
-rw-r--r--src/services/drive/image-processor.ts26
3 files changed, 3 insertions, 41 deletions
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts
index 877075b8b0..54aa018a46 100644
--- a/src/services/drive/add-file.ts
+++ b/src/services/drive/add-file.ts
@@ -10,7 +10,7 @@ import { deleteFile } from './delete-file';
import { fetchMeta } from '../../misc/fetch-meta';
import { GenerateVideoThumbnail } from './generate-video-thumbnail';
import { driveLogger } from './logger';
-import { IImage, convertToJpeg, convertToWebp, convertToPng, convertToGif, convertToApng } from './image-processor';
+import { IImage, convertToJpeg, convertToWebp, convertToPng } from './image-processor';
import { contentDisposition } from '../../misc/content-disposition';
import { detectMine } from '../../misc/detect-mine';
import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '../../models';
@@ -159,12 +159,6 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
webpublic = await convertToWebp(path, 2048, 2048);
} else if (['image/png'].includes(type)) {
webpublic = await convertToPng(path, 2048, 2048);
- } else if (['image/apng', 'image/vnd.mozilla.apng'].includes(type)) {
- webpublic = await convertToApng(path);
- } else if (['image/gif'].includes(type)) {
- webpublic = await convertToGif(path);
- } else {
- logger.info(`web image not created (not an image)`);
}
} catch (e) {
logger.warn(`web image not created (an error occured)`, e);
@@ -182,10 +176,6 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
thumbnail = await convertToJpeg(path, 498, 280);
} else if (['image/png'].includes(type)) {
thumbnail = await convertToPng(path, 498, 280);
- } else if (['image/gif'].includes(type)) {
- thumbnail = await convertToGif(path);
- } else if (['image/apng', 'image/vnd.mozilla.apng'].includes(type)) {
- thumbnail = await convertToApng(path);
} else if (type.startsWith('video/')) {
try {
thumbnail = await GenerateVideoThumbnail(path);
@@ -422,8 +412,6 @@ export default async function(
if (isLink) {
file.url = url;
- file.thumbnailUrl = url;
- file.webpublicUrl = url;
// ローカルプロキシ用
file.accessKey = uuid();
file.thumbnailAccessKey = 'thumbnail-' + uuid();
diff --git a/src/services/drive/delete-file.ts b/src/services/drive/delete-file.ts
index 18603617d2..00252a6f48 100644
--- a/src/services/drive/delete-file.ts
+++ b/src/services/drive/delete-file.ts
@@ -69,8 +69,8 @@ function postProcess(file: DriveFile, isExpired = false) {
DriveFiles.update(file.id, {
isLink: true,
url: file.uri,
- thumbnailUrl: file.uri,
- webpublicUrl: file.uri,
+ thumbnailUrl: null,
+ webpublicUrl: null,
size: 0,
// ローカルプロキシ用
accessKey: uuid(),
diff --git a/src/services/drive/image-processor.ts b/src/services/drive/image-processor.ts
index 4b8db0e0c8..e2dd90cfa0 100644
--- a/src/services/drive/image-processor.ts
+++ b/src/services/drive/image-processor.ts
@@ -74,29 +74,3 @@ export async function convertToPng(path: string, width: number, height: number):
type: 'image/png'
};
}
-
-/**
- * Convert to GIF (Actually just NOP)
- */
-export async function convertToGif(path: string): Promise<IImage> {
- const data = await fs.promises.readFile(path);
-
- return {
- data,
- ext: 'gif',
- type: 'image/gif'
- };
-}
-
-/**
- * Convert to APNG (Actually just NOP)
- */
-export async function convertToApng(path: string): Promise<IImage> {
- const data = await fs.promises.readFile(path);
-
- return {
- data,
- ext: 'apng',
- type: 'image/apng'
- };
-}