Route markdown to v1 (#680)

I think I just forgot to do it the first time.
This commit is contained in:
infinite-persistence 2022-01-12 07:31:46 -08:00 committed by GitHub
parent 431f55ef26
commit c90c5bcc2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -56,7 +56,7 @@ declare type PublishParams = {
declare type TusUploader = any; declare type TusUploader = any;
declare type FileUploadSdkParams = { declare type FileUploadSdkParams = {
file_path: string, file_path: string | File,
name: ?string, name: ?string,
preview?: boolean, preview?: boolean,
remote_url?: string, remote_url?: string,

View file

@ -16,6 +16,7 @@ export default function apiPublishCallViaWeb(
reject: Function reject: Function
) { ) {
const { file_path: filePath, preview, remote_url: remoteUrl } = params; const { file_path: filePath, preview, remote_url: remoteUrl } = params;
const isMarkdown = filePath && typeof filePath === 'object' && filePath.type === 'text/markdown';
if (!filePath && !remoteUrl) { if (!filePath && !remoteUrl) {
return apiCall(method, params, resolve, reject); return apiCall(method, params, resolve, reject);
@ -41,7 +42,7 @@ export default function apiPublishCallViaWeb(
params.guid = uuid(); params.guid = uuid();
} }
const useV1 = remoteUrl || preview || !tus.isSupported; const useV1 = remoteUrl || isMarkdown || preview || !tus.isSupported;
// Note: both function signature (params) should match. // Note: both function signature (params) should match.
const makeRequest = useV1 ? makeUploadRequest : makeResumableUploadRequest; const makeRequest = useV1 ? makeUploadRequest : makeResumableUploadRequest;