TagSpaces is an offline, open source, document manager with tagging support
fix: making extractTitle s3 win compartible
Ilian Sapundshiev6ee6018b2e0c
diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsxindex 41a353ccd..76b0b5d57 100644--- a/app/perspectives/grid-perspective/components/CellContent.tsx+++ b/app/perspectives/grid-perspective/components/CellContent.tsx@@ -35,6 +35,7 @@ import TagContainerDnd from '-/components/TagContainerDnd';import TagContainer from '-/components/TagContainer';import i18n from '-/services/i18n';import { Tag } from '-/reducers/taglibrary';+import PlatformIO from '-/services/platform-io';const maxDescriptionPreviewLength = 100;@@ -79,6 +80,11 @@ const CellContent = (props: Props) => {openFile} = props;const fsEntryBackgroundColor = fsEntry.color ? fsEntry.color : 'transparent';+ const entryTitle = extractTitle(+ fsEntry.name,+ !fsEntry.isFile,+ PlatformIO.getDirSeparator()+ );let description = removeMd(fsEntry.description);if (description.length > maxDescriptionPreviewLength) {@@ -160,7 +166,7 @@ const CellContent = (props: Props) => {noWrap={true}variant="body1">- {extractTitle(fsEntry.name, !fsEntry.isFile)}+ {entryTitle}</Typography>{fsEntry.isFile ? (<div className={classes.gridDetails}>@@ -260,7 +266,7 @@ const CellContent = (props: Props) => {}}><Typography style={{ wordBreak: 'break-all', alignSelf: 'center' }}>- {extractTitle(fsEntry.name, !fsEntry.isFile)}+ {entryTitle} {showTags? fsEntry.tags.map(tag => renderTag(tag))@@ -270,7 +276,7 @@ const CellContent = (props: Props) => {) : (<Grid item xs zeroMinWidth><Typography style={{ wordBreak: 'break-all' }}>- {extractTitle(fsEntry.name, !fsEntry.isFile)}+ {entryTitle}</Typography>{showTags? fsEntry.tags.map(tag => renderTag(tag))diff --git a/app/reducers/tagging-actions.ts b/app/reducers/tagging-actions.tsindex 8fb50a908..31690189f 100644--- a/app/reducers/tagging-actions.ts+++ b/app/reducers/tagging-actions.ts@@ -555,7 +555,11 @@ const actions = {// Tags in file name case, check is fileconst extractedTags = extractTags(path, settings.tagDelimiter);if (extractedTags.length > 0) {- const fileTitle = extractTitle(path);+ const fileTitle = extractTitle(+ path,+ false,+ PlatformIO.getDirSeparator()+ );let fileExt = extractFileExtension(path);const containingDirectoryPath = extractContainingDirectoryPath(path);if (fileExt.length > 0) {diff --git a/app/utils/paths.ts b/app/utils/paths.tsindex 5ceff06f5..eae7f3c6e 100644--- a/app/utils/paths.ts+++ b/app/utils/paths.ts@@ -263,7 +263,7 @@ export function extractContainingDirectoryName(filePath: string) {export function extractTitle(entryPath: string,isDirectory: boolean = false,- dirSeparator: string = AppConfig.dirSeparator+ dirSeparator: string // = AppConfig.dirSeparator) {let title;if (isDirectory) {@@ -306,7 +306,7 @@ export function extractTitle(export function extractTagsAsObjects(filePath: string,- tagDelimiter?: string+ tagDelimiter: string = AppConfig.tagDelimiter): Array<Tag> {const tagsInFileName = extractTags(filePath, tagDelimiter);const tagArray = [];@@ -320,12 +320,10 @@ export function extractTagsAsObjects(return tagArray;}-export function extractTags(filePath: string, tagDelimiter?: string) {- if (tagDelimiter === undefined) {- // TODO get tagDelimiter from settings reducer only- // eslint-disable-next-line no-param-reassign- tagDelimiter = AppConfig.tagDelimiter;- }+export function extractTags(+ filePath: string,+ tagDelimiter: string = AppConfig.tagDelimiter+) {// console.log('Extracting tags from: ' + filePath);const fileName = extractFileName(filePath);// WithoutExt