|
1 | 1 | import {ApiError} from 'app/common/ApiError';
|
2 | 2 | import {InactivityTimer} from 'app/common/InactivityTimer';
|
3 | 3 | import {FetchUrlOptions, FileUploadResult, UPLOAD_URL_PATH, UploadResult} from 'app/common/uploads';
|
4 |
| -import {DocAttachmentsLocation, getUrlFromPrefix} from 'app/common/UserAPI'; |
| 4 | +import {getUrlFromPrefix} from 'app/common/UserAPI'; |
5 | 5 | import {getAuthorizedUserId, getTransitiveHeaders, getUserId, isSingleUserMode,
|
6 | 6 | RequestWithLogin} from 'app/server/lib/Authorizer';
|
7 | 7 | import {expressWrap} from 'app/server/lib/expressWrap';
|
@@ -504,27 +504,6 @@ export async function fetchDoc(
|
504 | 504 | const docWorkerUrl = docWorker ? docWorker.internalUrl : getUrlFromPrefix(server.getHomeInternalUrl(), selfPrefix);
|
505 | 505 | const apiBaseUrl = docWorkerUrl.replace(/\/*$/, '/');
|
506 | 506 |
|
507 |
| - // Documents with external attachments can't be copied right now. Check status and alert the user. |
508 |
| - // Copying as a template is fine, as no attachments will be copied. |
509 |
| - if (!template) { |
510 |
| - const transferStatusResponse = await fetch( |
511 |
| - new URL(`api/docs/${docId}/attachments/transferStatus`, apiBaseUrl).href, |
512 |
| - { |
513 |
| - headers: { |
514 |
| - ...headers, |
515 |
| - 'Content-Type': 'application/json', |
516 |
| - } |
517 |
| - } |
518 |
| - ); |
519 |
| - if (!transferStatusResponse.ok) { |
520 |
| - throw new ApiError(await transferStatusResponse.text(), transferStatusResponse.status); |
521 |
| - } |
522 |
| - const attachmentsLocation: DocAttachmentsLocation = (await transferStatusResponse.json()).locationSummary; |
523 |
| - if (attachmentsLocation !== 'internal' && attachmentsLocation !== 'none') { |
524 |
| - throw new ApiError("Cannot copy a document with external attachments", 400); |
525 |
| - } |
526 |
| - } |
527 |
| - |
528 | 507 | // Download the document, in full or as a template.
|
529 | 508 | const url = new URL(`api/docs/${docId}/download?template=${Number(template)}`, apiBaseUrl);
|
530 | 509 | return _fetchURL(url.href, accessId, {headers});
|
|
0 commit comments