Skip to content

Commit

Permalink
Fixed asset naming normalization: now removing spaces from filenames!
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr. Robot committed Dec 1, 2023
1 parent f2c06ac commit af2c80c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/export/get-markdown-attachments.ts
Expand Up @@ -32,6 +32,7 @@ import { AttachmentLink } from "./get-links-and-attachments";
import { BulkExportSettings } from "src/models/bulk-export-settings";
import { getAssetPaths } from "src/utils/indexing/asset-and-link-paths";
import replaceAll from "src/utils/replace-all";
import normalizeFileName from "src/utils/normalize-file-name";

export const ATTACHMENT_URL_REGEXP = /!\[\[((.*?)\.(\w+))\]\]/g;
export const MARKDOWN_ATTACHMENT_URL_REGEXP = /!\[(.*?)\]\(((.*?)\.(\w+))\)/g;
Expand Down Expand Up @@ -114,7 +115,7 @@ async function saveAttachmentToLocation(
const { toDir, toDirRelative } = getAssetPaths(exportProperties, settings)

const imageLinkMd5 = Md5.hashStr(asset.path);
const imageTargetFileName = imageNameWithoutExtension + "-" + imageLinkMd5 + imageExtension;
const imageTargetFileName = normalizeFileName(imageNameWithoutExtension) + "-" + imageLinkMd5 + imageExtension;

// Calculate the link within the markdown file, using the target's relative path!
const documentLink = join(toDirRelative, imageTargetFileName);
Expand Down

0 comments on commit af2c80c

Please sign in to comment.