diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-05 18:08:51 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-05 18:08:51 +0900 |
| commit | 06347cd71e46ce2b991bc8b872cd0725c8862954 (patch) | |
| tree | d69635b44008bdfb3062a17cddf863281ca72cba /src/api | |
| parent | wip (diff) | |
| download | misskey-06347cd71e46ce2b991bc8b872cd0725c8862954.tar.gz misskey-06347cd71e46ce2b991bc8b872cd0725c8862954.tar.bz2 misskey-06347cd71e46ce2b991bc8b872cd0725c8862954.zip | |
wip
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/drive/upload-from-url.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/api/drive/upload-from-url.ts b/src/api/drive/upload-from-url.ts index 26c890d157..676586cd15 100644 --- a/src/api/drive/upload-from-url.ts +++ b/src/api/drive/upload-from-url.ts @@ -6,14 +6,18 @@ import * as tmp from 'tmp'; import * as fs from 'fs'; import * as request from 'request'; -const log = debug('misskey:common:drive:upload_from_url'); +const log = debug('misskey:drive:upload-from-url'); export default async (url, user, folderId = null, uri = null): Promise<IDriveFile> => { + log(`REQUESTED: ${url}`); + let name = URL.parse(url).pathname.split('/').pop(); if (!validateFileName(name)) { name = null; } + log(`name: ${name}`); + // Create temp file const path = await new Promise((res: (string) => void, rej) => { tmp.file((e, path) => { @@ -37,6 +41,8 @@ export default async (url, user, folderId = null, uri = null): Promise<IDriveFil const driveFile = await create(user, path, name, null, folderId, false, uri); + log(`created: ${driveFile._id}`); + // clean-up fs.unlink(path, (e) => { if (e) log(e.stack); |