TagSpaces is an offline, open source, document manager with tagging support
bugfixes
sytolkea7ce810b11b
diff --git a/src/main/mainEvents.ts b/src/main/mainEvents.tsindex 95fdcae01..b7d615d80 100644--- a/src/main/mainEvents.ts+++ b/src/main/mainEvents.ts@@ -28,6 +28,9 @@ import { postRequest, readMacOSTags } from './util';let watcher: FSWatcher = undefined;export default function loadMainEvents() {+ ipcMain.handle('resolveRelativePaths', (event, relativePath) => {+ return path.resolve(relativePath);+ });ipcMain.on('quitApp', () => {globalShortcut.unregisterAll();app.quit();diff --git a/src/main/preload.ts b/src/main/preload.tsindex 835a3bd2a..169959109 100644--- a/src/main/preload.ts+++ b/src/main/preload.ts@@ -3,6 +3,7 @@import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';export type Channels =+ | 'resolveRelativePaths'| 'set-language'| 'setZoomFactor'| 'global-shortcuts-enabled'diff --git a/src/renderer/components/DirectoryTreeView.tsx b/src/renderer/components/DirectoryTreeView.tsxindex 46c09df48..f154e4aae 100644--- a/src/renderer/components/DirectoryTreeView.tsx+++ b/src/renderer/components/DirectoryTreeView.tsx@@ -47,7 +47,7 @@ const DirectoryTreeView = forwardRef((props: Props, ref: Ref<DirectoryTreeViewRef>) => {const { classes, location, handleFileMoveDrop } = props;const { openDirectory } = useDirectoryContentContext();- const { changeLocation } = useCurrentLocationContext();+ const { changeLocation, currentLocationPath } = useCurrentLocationContext();const [data, setData] = useState(undefined);const [isExpanded, setExpanded] = useState(false);@@ -203,7 +203,7 @@ const DirectoryTreeView = forwardRef(uuid: location.uuid,name: location.name,type: location.type,- path: PlatformIO.getLocationPath(location),+ path: currentLocationPath, //PlatformIO.getLocationPath(location),};getDirectoriesTree(subFolder).then((children) => {diff --git a/src/renderer/components/LocationView.tsx b/src/renderer/components/LocationView.tsxindex 07f0d8054..4e544f43b 100644--- a/src/renderer/components/LocationView.tsx+++ b/src/renderer/components/LocationView.tsx@@ -60,6 +60,7 @@ function LocationView(props: Props) {const {openLocation,currentLocation,+ currentLocationPath,readOnlyMode,setSelectedLocation,setLocationDirectoryContextMenuAnchorEl,@@ -93,7 +94,7 @@ function LocationView(props: Props) {const handleLocationClick = () => {if (currentLocation && location.uuid === currentLocation.uuid) {// the same location click- openDirectory(PlatformIO.getLocationPath(location));+ openDirectory(currentLocationPath); //PlatformIO.getLocationPath(location));} else {// this.directoryTreeRef[location.uuid].loadSubDir(location, 1);setSelectedEntries([]);@@ -189,7 +190,7 @@ function LocationView(props: Props) {}};- let locationNameTitle = PlatformIO.getLocationPath(location);+ let locationNameTitle = currentLocationPath; //PlatformIO.getLocationPath(location);if (isCloudLocation && location.bucketName) {if (location.endpointURL) {locationNameTitle = location.endpointURL + ' - ' + location.bucketName;@@ -281,7 +282,7 @@ function LocationView(props: Props) {<TargetMoveFileBoxaccepts={[DragItemTypes.FILE]}onDrop={handleFileMoveDrop}- path={PlatformIO.getLocationPath(location)}+ path={currentLocationPath} //PlatformIO.getLocationPath(location)}location={location}>{LocationTitle}diff --git a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx b/src/renderer/components/dialogs/CreateEditLocationDialog.tsxindex a691a1d34..fe0b597d4 100644--- a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx+++ b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx@@ -974,7 +974,7 @@ function CreateEditLocationDialog(props: Props) {onClose={() => setIgnorePatternDialogOpen(false)}ignorePatternPaths={ignorePatternPaths}setIgnorePatternPaths={setIgnorePatternPaths}- locationPath={PlatformIO.getLocationPath(selectedLocation)}+ location={selectedLocation}/>)}</>diff --git a/src/renderer/components/menus/DirectoryMenu.tsx b/src/renderer/components/menus/DirectoryMenu.tsxindex 14212eab7..d4211564f 100644--- a/src/renderer/components/menus/DirectoryMenu.tsx+++ b/src/renderer/components/menus/DirectoryMenu.tsx@@ -70,7 +70,8 @@ function DirectoryMenu(props: Props) {const { openEntry } = useOpenedEntryContext();const { selectedEntries, setSelectedEntries } = useSelectedEntriesContext();const { addTags } = useTaggingActionsContext();- const { currentLocation, readOnlyMode } = useCurrentLocationContext();+ const { currentLocation, readOnlyMode, getLocationPath } =+ useCurrentLocationContext();const { showNotification } = useNotificationContext();const {openDirectory,@@ -117,7 +118,7 @@ function DirectoryMenu(props: Props) {dispatch(AppActions.toggleProTeaser(slidePage));};- function generateFolderLink() {+ function generateFolderLink(): Promise<string> {let locationID = currentLocation.uuid;let entryPath = currentDirectoryPath;if (selectedEntries && selectedEntries.length > 0) {@@ -127,23 +128,25 @@ function DirectoryMenu(props: Props) {entryPath = selectedEntries[0].path;}const tmpLoc = locations.find((location) => location.uuid === locationID);- const relativePath = getRelativeEntryPath(tmpLoc, entryPath);- return generateSharingLink(locationID, undefined, relativePath);+ return getLocationPath(tmpLoc).then((locationPath) => {+ const relativePath = getRelativeEntryPath(locationPath, entryPath);+ return generateSharingLink(locationID, undefined, relativePath);+ });}function copySharingLink() {//if (selectedEntries && selectedEntries.length === 1) {- const sharingLink = generateFolderLink();- navigator.clipboard- .writeText(sharingLink)- .then(() => {- showNotification(t('core:sharingLinkCopied'));- return true;- })- .catch(() => {- showNotification(t('core:sharingLinkFailed'));- });- //}+ generateFolderLink().then((sharingLink) =>+ navigator.clipboard+ .writeText(sharingLink)+ .then(() => {+ showNotification(t('core:sharingLinkCopied'));+ return true;+ })+ .catch(() => {+ showNotification(t('core:sharingLinkFailed'));+ }),+ );}/* const [@@ -233,13 +236,11 @@ function DirectoryMenu(props: Props) {}function openInNewWindow() {- // onClose();- //if (selectedEntries && selectedEntries.length === 1) {- const sharingLink = generateFolderLink();- const newInstanceLink =- window.location.href.split('?')[0] + '?' + sharingLink.split('?')[1];- PlatformIO.createNewInstance(newInstanceLink);- //}+ generateFolderLink().then((sharingLink) => {+ const newInstanceLink =+ window.location.href.split('?')[0] + '?' + sharingLink.split('?')[1];+ PlatformIO.createNewInstance(newInstanceLink);+ });}function addExistingFile() {diff --git a/src/renderer/components/menus/FileMenu.tsx b/src/renderer/components/menus/FileMenu.tsxindex f7d69b298..ad0392dd7 100644--- a/src/renderer/components/menus/FileMenu.tsx+++ b/src/renderer/components/menus/FileMenu.tsx@@ -114,7 +114,8 @@ function FileMenu(props: Props) {const { showNotification } = useNotificationContext();const { copyFilePromise, setFolderThumbnailPromise } =usePlatformFacadeContext();- const { currentLocation, readOnlyMode } = useCurrentLocationContext();+ const { currentLocation, readOnlyMode, currentLocationPath } =+ useCurrentLocationContext();//const locations: Array<TS.Location> = useSelector(getLocations);const prefixTagContainer = useSelector(getPrefixTagContainer);const warningOpeningFilesExternally = useSelector(@@ -129,7 +130,7 @@ function FileMenu(props: Props) {const entryPath = selectedEntries[0].path;/*const tmpLoc = locations.find(location => location.uuid === locationID);*/- const relativePath = getRelativeEntryPath(currentLocation, entryPath);+ const relativePath = getRelativeEntryPath(currentLocationPath, entryPath);return generateSharingLink(currentLocation.uuid, relativePath);}diff --git a/src/renderer/components/menus/LocationContextMenu.tsx b/src/renderer/components/menus/LocationContextMenu.tsxindex f38258002..620d80475 100644--- a/src/renderer/components/menus/LocationContextMenu.tsx+++ b/src/renderer/components/menus/LocationContextMenu.tsx@@ -63,6 +63,7 @@ function LocationContextMenu(props: Props) {selectedLocation,locationDirectoryContextMenuAnchorEl,setLocationDirectoryContextMenuAnchorEl,+ getLocationPath,} = useCurrentLocationContext();const { createLocationIndex } = useLocationIndexContext();const dispatch: AppDispatch = useDispatch();@@ -121,7 +122,9 @@ function LocationContextMenu(props: Props) {const showInFileManagerInt = () => {setLocationDirectoryContextMenuAnchorEl(null);- PlatformIO.openDirectory(PlatformIO.getLocationPath(selectedLocation));+ getLocationPath(selectedLocation).then((path) =>+ PlatformIO.openDirectory(path),+ );};const closeLocationInt = () => {diff --git a/src/renderer/hooks/CurrentLocationContextProvider.tsx b/src/renderer/hooks/CurrentLocationContextProvider.tsxindex 5610bcd98..812b499c1 100644--- a/src/renderer/hooks/CurrentLocationContextProvider.tsx+++ b/src/renderer/hooks/CurrentLocationContextProvider.tsx@@ -42,9 +42,11 @@ import { getPersistTagsInSidecarFile } from '-/reducers/settings';type CurrentLocationContextData = {currentLocation: TS.Location;+ currentLocationPath: string;readOnlyMode: boolean;skipInitialDirList: boolean;persistTagsInSidecarFile: boolean;+ getLocationPath: (location: TS.Location) => Promise<string>;changeLocation: (location: TS.Location) => void;editLocation: (location: TS.Location, openAfterEdit?: boolean) => void;addLocation: (@@ -70,9 +72,11 @@ type CurrentLocationContextData = {export const CurrentLocationContext = createContext<CurrentLocationContextData>({currentLocation: undefined,+ currentLocationPath: undefined,readOnlyMode: false,skipInitialDirList: false,persistTagsInSidecarFile: true,+ getLocationPath: undefined,changeLocation: () => {},editLocation: () => {},addLocation: () => {},@@ -104,6 +108,7 @@ export const CurrentLocationContextProvider = ({const { showNotification } = useNotificationContext();const [currentLocation, setCurrentLocation] =useState<TS.Location>(undefined);+ const currentLocationPath = useRef<string>('');const selectedLocation = useRef<TS.Location>(undefined);const skipInitialDirList = useRef<boolean>(false);const [@@ -130,6 +135,14 @@ export const CurrentLocationContextProvider = ({}}, []);+ useEffect(() => {+ if (currentLocation) {+ getLocationPath(currentLocation).then(+ (path) => (currentLocationPath.current = path),+ );+ }+ }, [currentLocation]);+useEffect(() => {if (locations.length < 1) {// init locations@@ -147,6 +160,27 @@ export const CurrentLocationContextProvider = ({}}, [locations]);+ function getLocationPath(location: TS.Location): Promise<string> {+ let locationPath = '';+ if (location) {+ if (location.path) {+ locationPath = location.path;+ }+ if (location.paths && location.paths[0]) {+ // eslint-disable-next-line prefer-destructuring+ locationPath = location.paths[0];+ }++ if (locationPath && locationPath.startsWith('./')) {+ // TODO test relative path (Directory Back) with other platforms+ // relative paths+ return window.electronIO.ipcRenderer.invoke('resolveRelativePaths');+ }+ }++ return Promise.resolve(locationPath);+ }+function setSelectedLocation(location: TS.Location) {selectedLocation.current = location;}@@ -369,9 +403,11 @@ export const CurrentLocationContextProvider = ({const context = useMemo(() => {return {currentLocation,+ currentLocationPath: currentLocationPath.current,readOnlyMode,skipInitialDirList: skipInitialDirList.current,persistTagsInSidecarFile,+ getLocationPath,changeLocation,addLocation,addLocations,@@ -391,6 +427,7 @@ export const CurrentLocationContextProvider = ({};}, [currentLocation,+ currentLocationPath.current,persistTagsInSidecarFile,skipInitialDirList.current,locationDirectoryContextMenuAnchorEl,diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsxindex c3a349dde..5e832e2f5 100644--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx@@ -171,8 +171,12 @@ export const DirectoryContentContextProvider = ({}: DirectoryContentContextProviderProps) => {const dispatch: AppDispatch = useDispatch();const { t } = useTranslation();- const { closeAllLocations, currentLocation, skipInitialDirList } =- useCurrentLocationContext();+ const {+ closeAllLocations,+ currentLocation,+ skipInitialDirList,+ currentLocationPath,+ } = useCurrentLocationContext();const { showNotification, hideNotifications } = useNotificationContext();const { selectedEntries, setSelectedEntries } = useSelectedEntriesContext();@@ -215,7 +219,7 @@ export const DirectoryContentContextProvider = ({useEffect(() => {if (currentLocation) {if (!skipInitialDirList) {- openDirectory(PlatformIO.getLocationPath(currentLocation));+ openDirectory(currentLocationPath);}} else {clearDirectoryContent();@@ -365,9 +369,9 @@ export const DirectoryContentContextProvider = ({if (isSearchMode.current) {exitSearchMode();}- const currentLocationPath = normalizePath(+ /*const currentLocationPath = normalizePath(PlatformIO.getLocationPath(currentLocation),- );+ );*/// dispatch(actions.setIsLoading(true));@@ -549,7 +553,10 @@ export const DirectoryContentContextProvider = ({//OPEN ISTRUNCATED dialogdispatch(AppActions.toggleTruncatedConfirmDialog());}- updateHistory(currentLocation, directoryPath);+ updateHistory(+ { ...currentLocation, path: currentLocationPath },+ directoryPath,+ );if (results !== undefined) {// console.debug('app listDirectoryPromise resolved:' + results.length);return loadDirectorySuccess(diff --git a/src/renderer/hooks/FSWatcherContextProvider.tsx b/src/renderer/hooks/FSWatcherContextProvider.tsxindex 658cf3afc..6673bca0a 100644--- a/src/renderer/hooks/FSWatcherContextProvider.tsx+++ b/src/renderer/hooks/FSWatcherContextProvider.tsx@@ -67,7 +67,7 @@ export type FSWatcherContextProviderProps = {export const FSWatcherContextProvider = ({children,}: FSWatcherContextProviderProps) => {- const { currentLocation } = useCurrentLocationContext();+ const { currentLocation, currentLocationPath } = useCurrentLocationContext();const {loadDirectoryContent,currentDirectoryPath,@@ -89,7 +89,7 @@ export const FSWatcherContextProvider = ({const depth =currentDirectoryPerspective === PerspectiveIDs.KANBAN ? 3 : 1;- watchFolder(PlatformIO.getLocationPath(currentLocation), depth);+ watchFolder(currentLocationPath, depth);} else {stopWatching();}diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsxindex 02e6ded3a..a8cbb4dc4 100644--- a/src/renderer/hooks/LocationIndexContextProvider.tsx+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx@@ -38,8 +38,6 @@ import {} from '@tagspaces/tagspaces-common/paths';import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';import { useNotificationContext } from '-/hooks/useNotificationContext';-import { Pro } from '-/pro';-import { PerspectiveIDs } from '-/perspectives';type LocationIndexContextData = {index: TS.FileSystemEntry[];@@ -91,12 +89,10 @@ export const LocationIndexContextProvider = ({const { t } = useTranslation();const dispatch: AppDispatch = useDispatch();- const { currentLocation } = useCurrentLocationContext();+ const { currentLocation, getLocationPath } = useCurrentLocationContext();const {setSearchResults,appendSearchResults,- loadDirectoryContent,- currentDirectoryPerspective,addDirectoryEntries,removeDirectoryEntries,} = useDirectoryContentContext();@@ -276,53 +272,59 @@ export const LocationIndexContextProvider = ({if (location) {const isCurrentLocation =currentLocation && currentLocation.uuid === location.uuid;- if (location.type === locationType.TYPE_CLOUD) {- return PlatformIO.enableObjectStoreSupport(location)- .then(() =>- createDirIndex(- PlatformIO.getLocationPath(location),- location.fullTextIndex,- isCurrentLocation,- location.uuid,- ),- )- .catch(() => {- PlatformIO.disableObjectStoreSupport();- return false;- });- } else if (location.type === locationType.TYPE_WEBDAV) {- PlatformIO.enableWebdavSupport(location);- return createDirIndex(- PlatformIO.getLocationPath(location),- location.fullTextIndex,- isCurrentLocation,- location.uuid,- );- } else if (location.type === locationType.TYPE_LOCAL) {- PlatformIO.disableObjectStoreSupport();- return createDirIndex(- PlatformIO.getLocationPath(location),- location.fullTextIndex,- isCurrentLocation,- location.uuid,- );- }+ getLocationPath(location).then((locationPath) => {+ if (location.type === locationType.TYPE_CLOUD) {+ return PlatformIO.enableObjectStoreSupport(location)+ .then(() =>+ createDirIndex(+ locationPath,+ location.fullTextIndex,+ isCurrentLocation,+ location.uuid,+ ),+ )+ .catch(() => {+ PlatformIO.disableObjectStoreSupport();+ return false;+ });+ } else if (location.type === locationType.TYPE_WEBDAV) {+ PlatformIO.enableWebdavSupport(location);+ return createDirIndex(+ locationPath,+ location.fullTextIndex,+ isCurrentLocation,+ location.uuid,+ );+ } else if (location.type === locationType.TYPE_LOCAL) {+ PlatformIO.disableObjectStoreSupport();+ return createDirIndex(+ locationPath,+ location.fullTextIndex,+ isCurrentLocation,+ location.uuid,+ );+ }+ });}return Promise.resolve(false);}function createLocationsIndexes(extractText = true): Promise<boolean> {isIndexing.current = true;- const promises = allLocations.map((location: TS.Location) => {- const nextPath = PlatformIO.getLocationPath(location);- return (+ const promises = allLocations.map((location: TS.Location) =>+ getLocationPath(location).then((locationPath) =>createDirectoryIndex(- { path: nextPath, location: location.uuid },+ { path: locationPath, location: location.uuid },extractText,location.ignorePatternPaths,enableWS,- )- /* .then(directoryIndex => {+ ).catch((err) => {+ isIndexing.current = false;+ lastError.current = err;+ }),+ ),+ );+ /* .then(directoryIndex => {if (Pro && Pro.Indexer) {Pro.Indexer.persistIndex(nextPath,@@ -332,12 +334,6 @@ export const LocationIndexContextProvider = ({}return true;}) */- .catch((err) => {- isIndexing.current = false;- lastError.current = err;- })- );- });return Promise.all(promises).then((e) => {@@ -383,12 +379,13 @@ export const LocationIndexContextProvider = ({const maxIndexAge = currentLocation.maxIndexAge? currentLocation.maxIndexAge: AppConfig.maxIndexAge;++ const currentPath = await getLocationPath(currentLocation);if (searchQuery.forceIndexing ||(!currentLocation.disableIndexing &&(!index || index.length < 1 || indexAge > maxIndexAge))) {- const currentPath = PlatformIO.getLocationPath(currentLocation);console.log('Start creating index for : ' + currentPath);const newIndex = await createDirectoryIndex({@@ -404,7 +401,7 @@ export const LocationIndexContextProvider = ({} else if (isCloudLocation || !index || index.length === 0) {const newIndex = await loadIndex({- path: PlatformIO.getLocationPath(currentLocation),+ path: currentPath,locationID: currentLocation.uuid,...(isCloudLocation && { bucketName: currentLocation.bucketName }),},@@ -473,7 +470,7 @@ export const LocationIndexContextProvider = ({maxSearchResultReached = true;return Promise.resolve();}- const nextPath = PlatformIO.getLocationPath(location);+ const nextPath = await getLocationPath(location);let directoryIndex = [];let indexExist = false;const isCloudLocation = location.type === locationType.TYPE_CLOUD;diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsxindex 25929a594..489d67541 100644--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx@@ -36,7 +36,6 @@ import PlatformIO from '-/services/platform-facade';import {findExtensionsForEntry,getAllPropertiesPromise,- getCleanLocationPath,getNextFile,getPrevFile,getRelativeEntryPath,@@ -150,6 +149,12 @@ export const OpenedEntryContextProvider = ({const dispatch: AppDispatch = useDispatch();const { t } = useTranslation();+ const {+ openLocation,+ currentLocation,+ getLocationPath,+ currentLocationPath,+ } = useCurrentLocationContext();const {currentDirectoryEntries,currentDirectoryPath,@@ -159,7 +164,6 @@ export const OpenedEntryContextProvider = ({const { selectedEntries, setSelectedEntries } = useSelectedEntriesContext();const { showNotification } = useNotificationContext();- const { openLocation, currentLocation } = useCurrentLocationContext();const { reflectCreateEntry } = useLocationIndexContext();const { saveFilePromise } = usePlatformFacadeContext();@@ -658,7 +662,11 @@ export const OpenedEntryContextProvider = ({if (currentLocation) {entryForOpening.locationId = currentLocation.uuid;- updateHistory(currentLocation, currentDirectoryPath, fsEntry.path);+ updateHistory(+ { ...currentLocation, path: currentLocationPath },+ currentDirectoryPath,+ fsEntry.path,+ );}addToEntryContainer(entryForOpening);@@ -667,7 +675,7 @@ export const OpenedEntryContextProvider = ({if (currentLocation) {if (Pro) {const relEntryPath = getRelativeEntryPath(- currentLocation,+ currentLocationPath,fsEntry.path,);const historyKeys = Pro.history.historyKeys;@@ -810,82 +818,81 @@ export const OpenedEntryContextProvider = ({} else {openLocationTimer = 0;}- const locationPath = getCleanLocationPath(targetLocation);+ getLocationPath(targetLocation).then((path) => {+ const locationPath: string = cleanTrailingDirSeparator(path);- // setTimeout is needed for case of a location switch, if no location swith the timer is 0- setTimeout(() => {- if (isCloudLocation) {- // PlatformIO.enableObjectStoreSupport(targetLocation).then(() => {- if (directoryPath && directoryPath.length > 0) {- const newRelDir = getRelativeEntryPath(- targetLocation,- directoryPath,- );- const dirFullPath =- locationPath.length > 0- ? locationPath + '/' + newRelDir- : directoryPath;- openDirectory(dirFullPath);- } else {- openDirectory(locationPath);- }+ // setTimeout is needed for case of a location switch, if no location swith the timer is 0+ setTimeout(() => {+ if (isCloudLocation) {+ // PlatformIO.enableObjectStoreSupport(targetLocation).then(() => {+ if (directoryPath && directoryPath.length > 0) {+ const newRelDir = getRelativeEntryPath(path, directoryPath);+ const dirFullPath =+ locationPath.length > 0+ ? locationPath + '/' + newRelDir+ : directoryPath;+ openDirectory(dirFullPath);+ } else {+ openDirectory(locationPath);+ }- if (entryPath) {- getAllPropertiesPromise(entryPath)- .then((fsEntry: TS.FileSystemEntry) => {- if (fsEntry) {- openFsEntry(fsEntry);- if (options.fullWidth) {- setEntryInFullWidth(true);+ if (entryPath) {+ getAllPropertiesPromise(entryPath)+ .then((fsEntry: TS.FileSystemEntry) => {+ if (fsEntry) {+ openFsEntry(fsEntry);+ if (options.fullWidth) {+ setEntryInFullWidth(true);+ }}- }- return true;- })- .catch(() =>- showNotification(t('core:invalidLink'), 'warning', true),- );- }- // });- } else {- // local files case- if (directoryPath && directoryPath.length > 0) {- if (- directoryPath.includes('../') ||- directoryPath.includes('..\\')- ) {- showNotification(t('core:invalidLink'), 'warning', true);- return true;+ return true;+ })+ .catch(() =>+ showNotification(t('core:invalidLink'), 'warning', true),+ );}- const dirFullPath =- locationPath + PlatformIO.getDirSeparator() + directoryPath;- openDirectory(dirFullPath);+ // });} else {- openDirectory(locationPath);- }-- if (entryPath && entryPath.length > 0) {- if (entryPath.includes('../') || entryPath.includes('..\\')) {- showNotification(t('core:invalidLink'), 'warning', true);- return true;+ // local files case+ if (directoryPath && directoryPath.length > 0) {+ if (+ directoryPath.includes('../') ||+ directoryPath.includes('..\\')+ ) {+ showNotification(t('core:invalidLink'), 'warning', true);+ return true;+ }+ const dirFullPath =+ locationPath + PlatformIO.getDirSeparator() + directoryPath;+ openDirectory(dirFullPath);+ } else {+ openDirectory(locationPath);}- const entryFullPath =- locationPath + PlatformIO.getDirSeparator() + entryPath;- getAllPropertiesPromise(entryFullPath)- .then((fsEntry: TS.FileSystemEntry) => {- if (fsEntry) {- openFsEntry(fsEntry);- if (options.fullWidth) {- setEntryInFullWidth(true);- }- }++ if (entryPath && entryPath.length > 0) {+ if (entryPath.includes('../') || entryPath.includes('..\\')) {+ showNotification(t('core:invalidLink'), 'warning', true);return true;- })- .catch(() =>- showNotification(t('core:invalidLink'), 'warning', true),- );+ }+ const entryFullPath =+ locationPath + PlatformIO.getDirSeparator() + entryPath;+ getAllPropertiesPromise(entryFullPath)+ .then((fsEntry: TS.FileSystemEntry) => {+ if (fsEntry) {+ openFsEntry(fsEntry);+ if (options.fullWidth) {+ setEntryInFullWidth(true);+ }+ }+ return true;+ })+ .catch(() =>+ showNotification(t('core:invalidLink'), 'warning', true),+ );+ }}- }- }, openLocationTimer);+ }, openLocationTimer);+ });} else {showNotification(t('core:invalidLink'), 'warning', true);}@@ -990,7 +997,11 @@ export const OpenedEntryContextProvider = ({if (openedEntries && openedEntries.length > 0) {if (openedEntries[0].path === entryPath) {if (currentLocation) {- updateHistory(currentLocation, currentDirectoryPath, newEntryPath);+ updateHistory(+ { ...currentLocation, path: currentLocationPath },+ currentDirectoryPath,+ newEntryPath,+ );}if (reload) {openEntry(newEntryPath);diff --git a/src/renderer/hooks/PlatformFacadeContextProvider.tsx b/src/renderer/hooks/PlatformFacadeContextProvider.tsxindex d0615bacb..a3884d577 100644--- a/src/renderer/hooks/PlatformFacadeContextProvider.tsx+++ b/src/renderer/hooks/PlatformFacadeContextProvider.tsx@@ -125,34 +125,6 @@ export const PlatformFacadeContextProvider = ({const { t } = useTranslation();const dispatch: AppDispatch = useDispatch();- /*function enableObjectStoreSupport(objectStoreConfig: any): Promise<any> {- return platformEnableObjectStoreSupport(objectStoreConfig);- }- function disableObjectStoreSupport() {- platformDisableObjectStoreSupport();- }- function enableWebdavSupport(webDavConfig: any) {- platformEnableWebdavSupport(webDavConfig);- }- function disableWebdavSupport() {- platformDisableWebdavSupport();- }- function haveObjectStoreSupport(): boolean {- return platformHaveObjectStoreSupport();- }- function haveWebDavSupport(): boolean {- return platformHaveWebDavSupport();- }- function isMinio(): boolean {- return platformIsMinio();- }- function getDirSeparator(): string {- return platformGetDirSeparator();- }- function getLocationPath(location: TS.Location): string {- return platformGetLocationPath(location);- }*/-function createDirectoryPromise(path: string): Promise<any> {ignoreByWatcher(path);diff --git a/src/renderer/perspectives/grid-perspective/components/MainContainer.tsx b/src/renderer/perspectives/grid-perspective/components/MainContainer.tsxindex c070e935b..1c2121026 100644--- a/src/renderer/perspectives/grid-perspective/components/MainContainer.tsx+++ b/src/renderer/perspectives/grid-perspective/components/MainContainer.tsx@@ -526,9 +526,7 @@ function GridPerspective(props: Props) {const sortedDirectories = sortedDirContent.filter((entry) => !entry.isFile);const sortedFiles = sortedDirContent.filter((entry) => entry.isFile);- /*const locationPath = currentLocation- ? PlatformIO.getLocationPath(currentLocation)- : '';*/+let entryWidth = 200;if (entrySize.current === 'small') {entryWidth = 150;diff --git a/src/renderer/perspectives/list/components/MainContainer.tsx b/src/renderer/perspectives/list/components/MainContainer.tsxindex 58e6c3340..aaa296e95 100644--- a/src/renderer/perspectives/list/components/MainContainer.tsx+++ b/src/renderer/perspectives/list/components/MainContainer.tsx@@ -519,9 +519,7 @@ function ListPerspective(props: Props) {const sortedDirectories = sortedDirContent.filter((entry) => !entry.isFile);const sortedFiles = sortedDirContent.filter((entry) => entry.isFile);- /*const locationPath = currentLocation- ? PlatformIO.getLocationPath(currentLocation)- : '';*/+let entryWidth = 200;if (entrySize.current === 'small') {entryWidth = 150;diff --git a/src/renderer/services/platform-facade.ts b/src/renderer/services/platform-facade.tsindex 53bc08729..638ee7dfc 100644--- a/src/renderer/services/platform-facade.ts+++ b/src/renderer/services/platform-facade.ts@@ -25,11 +25,6 @@ import {platformDisableObjectStoreSupport,platformEnableWebdavSupport,platformDisableWebdavSupport,- platformGetLocationPath,- platformSetLanguage,- platformSetZoomFactorElectron,- platformSetGlobalShortcuts,- platformShowMainWindow,platformQuitApp,platformGetDevicePaths,platformGetURLforPath,@@ -89,8 +84,7 @@ export default class PlatformFacade {* todo rethink this use node path module* @param location*/- static getLocationPath = (location: TS.Location): string =>- platformGetLocationPath(location);+ // static getLocationPath = (location: TS.Location): string => platformGetLocationPath(location);static setLanguage = (language: string): void => {if (AppConfig.isElectron) {@@ -585,10 +579,6 @@ export default class PlatformFacade {}};- /* @deprecated not work in S3 use getLocationPath instead- static resolveFilePath = (filePath: string): string =>- platformResolveFilePath(filePath);*/-static openUrl = (url: string): void => {if (AppConfig.isElectron) {window.electronIO.ipcRenderer.sendMessage('openUrl', url);diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.tsindex 57b4317d8..ff5cfd55a 100644--- a/src/renderer/services/utils-io.ts+++ b/src/renderer/services/utils-io.ts@@ -1465,23 +1465,24 @@ export function setLocationType(location: TS.Location): Promise<boolean> {return Promise.resolve(false);}-export function getCleanLocationPath(location: TS.Location): string {+/*export function getCleanLocationPath(location: TS.Location): string {let locationPath = PlatformIO.getLocationPath(location);locationPath = cleanTrailingDirSeparator(locationPath);return locationPath;-}+}*/export function getRelativeEntryPath(- location: TS.Location,+ currentLocationPath: string,entryPath: string,): string {const entryPathCleaned = cleanTrailingDirSeparator(entryPath);+ const currentPathCleaned = cleanTrailingDirSeparator(currentLocationPath);// const isCloudLocation = location.type === locationType.TYPE_CLOUD;- const currentLocationPath = getCleanLocationPath(location);+ // const currentLocationPath = getCleanLocationPath(location);// let relEntryPath = isCloudLocation// ? entryPathCleaned// : entryPathCleaned.replace(currentLocationPath, '');- let relEntryPath = entryPathCleaned.replace(currentLocationPath, '');+ let relEntryPath = entryPathCleaned.replace(currentPathCleaned, '');relEntryPath = cleanFrontDirSeparator(relEntryPath);return relEntryPath;}diff --git a/src/renderer/utils/dom.ts b/src/renderer/utils/dom.tsindex a34031a91..701abca63 100644--- a/src/renderer/utils/dom.ts+++ b/src/renderer/utils/dom.ts@@ -58,7 +58,10 @@ export function updateHistory(}if (newDirectoryPath && newDirectoryPath.length > 0) {- const newRelDir = getRelativeEntryPath(newLocation, newDirectoryPath);+ const newRelDir = getRelativeEntryPath(+ newLocation.path,+ newDirectoryPath,+ );if (newRelDir) {const newEncRelDir = encodeURIComponent(newRelDir);urlParams += '&tsdpath=' + newEncRelDir;@@ -67,7 +70,7 @@ export function updateHistory(}if (newEntryPath && newEntryPath.length > 0) {- const entryRelPath = getRelativeEntryPath(newLocation, newEntryPath);+ const entryRelPath = getRelativeEntryPath(newLocation.path, newEntryPath);if (entryRelPath) {const newEncEntryPath = encodeURIComponent(entryRelPath);urlParams += '&tsepath=' + newEncEntryPath;