From db1a477cc0660b3238a3d375306634df13b0d19c Mon Sep 17 00:00:00 2001 From: Mike Sawka Date: Tue, 18 Feb 2025 15:56:30 -0800 Subject: [PATCH] fix two weird slash issues in file url (#1988) --- frontend/app/view/preview/preview.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/app/view/preview/preview.tsx b/frontend/app/view/preview/preview.tsx index afdc8cbe2..5a48b4d1e 100644 --- a/frontend/app/view/preview/preview.tsx +++ b/frontend/app/view/preview/preview.tsx @@ -254,7 +254,9 @@ export class PreviewModel implements ViewModel { headerPath = `~ (${loadableFileInfo.data?.dir + "/" + loadableFileInfo.data?.name})`; } } - + if (!isBlank(headerPath) && headerPath != "/" && headerPath.endsWith("/")) { + headerPath = headerPath.slice(0, -1); + } const viewTextChildren: HeaderElem[] = [ { elemtype: "text", @@ -692,6 +694,12 @@ export class PreviewModel implements ViewModel { } async handleOpenFile(filePath: string) { + const conn = globalStore.get(this.connectionImmediate); + if (!isBlank(conn) && conn.startsWith("aws:")) { + if (!isBlank(filePath) && filePath != "/" && filePath.startsWith("/")) { + filePath = filePath.substring(1); + } + } const fileInfo = await globalStore.get(this.statFile); this.updateOpenFileModalAndError(false); if (fileInfo == null) { @@ -1142,7 +1150,6 @@ function PreviewView({ return null; } const handleSelect = (s: SuggestionType, queryStr: string): boolean => { - console.log("handleSelect", s, queryStr); if (s == null) { if (isBlank(queryStr)) { globalStore.set(model.openFileModal, false);