You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import { ResourceEntity } from './services/database/types';
|
||||
import { TextItem } from 'pdfjs-dist/types/src/display/api';
|
||||
import replaceUnsupportedCharacters from './utils/replaceUnsupportedCharacters';
|
||||
import { FetchBlobOptions } from './types';
|
||||
import { fromFile as fileTypeFromFile } from 'file-type';
|
||||
import crypto from './services/e2ee/crypto';
|
||||
|
||||
import FileApiDriverLocal from './file-api-driver-local';
|
||||
@@ -306,9 +307,6 @@ function shimInit(options: ShimInitOptions = null) {
|
||||
...options,
|
||||
};
|
||||
|
||||
const readChunk = require('read-chunk');
|
||||
const imageType = require('image-type');
|
||||
|
||||
const isUpdate = !!options.destinationResourceId;
|
||||
|
||||
const uuid = require('./uuid').default;
|
||||
@@ -332,8 +330,7 @@ function shimInit(options: ShimInitOptions = null) {
|
||||
let fileExt = safeFileExtension(fileExtension(filePath));
|
||||
|
||||
if (!resource.mime) {
|
||||
const buffer = await readChunk(filePath, 0, 64);
|
||||
const detectedType = imageType(buffer);
|
||||
const detectedType = await fileTypeFromFile(filePath);
|
||||
|
||||
if (detectedType) {
|
||||
fileExt = detectedType.ext;
|
||||
|
||||
Reference in New Issue
Block a user