Skip to content

Commit e05211f

Browse files
committed
fix: show platform display path instead of /tauri/ virtual path in media/image preview header
Media and image preview panes used makeProjectRelativeIfPossible(), which returns out-of-project paths unmodified, leaking the /tauri/ virtual path prefix into the header for files outside the current project. Use getProjectRelativeOrDisplayPath() so the path is run through Phoenix.app.getDisplayPath() and shown as the real platform path.
1 parent c12814e commit e05211f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/editor/ImageViewer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ define(function (require, exports, module) {
6767
this._scale = 100; // 100%
6868
this._scaleDivInfo = null; // coordinates of hidden scale sticker
6969

70-
this.relPath = ProjectManager.makeProjectRelativeIfPossible(this.file.fullPath);
70+
this.relPath = ProjectManager.getProjectRelativeOrDisplayPath(this.file.fullPath);
7171

7272
this.$imagePath = this.$el.find(".image-path");
7373
this.$imagePreview = this.$el.find(".image-preview");
@@ -108,7 +108,7 @@ define(function (require, exports, module) {
108108
* so we just need to see if the file has the same path as our image
109109
*/
110110
if (this.file.fullPath === newPath) {
111-
this.relPath = ProjectManager.makeProjectRelativeIfPossible(newPath);
111+
this.relPath = ProjectManager.getProjectRelativeOrDisplayPath(newPath);
112112
this.$imagePath.text(this.relPath).attr("title", this.relPath);
113113
}
114114
};

src/editor/MediaViewer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ define(function (require, exports, module) {
117117
this._naturalWidth = 0;
118118
this._naturalHeight = 0;
119119

120-
this.relPath = ProjectManager.makeProjectRelativeIfPossible(this.file.fullPath);
120+
this.relPath = ProjectManager.getProjectRelativeOrDisplayPath(this.file.fullPath);
121121

122122
this.$mediaPath = this.$el.find(".media-path");
123123
this.$mediaPreview = this.$el.find(".media-preview");
@@ -175,7 +175,7 @@ define(function (require, exports, module) {
175175
*/
176176
MediaView.prototype._onFilenameChange = function (e, oldPath, newPath) {
177177
if (this.file.fullPath === newPath) {
178-
this.relPath = ProjectManager.makeProjectRelativeIfPossible(newPath);
178+
this.relPath = ProjectManager.getProjectRelativeOrDisplayPath(newPath);
179179
this.$mediaPath.text(this.relPath).attr("title", this.relPath);
180180
}
181181
};

0 commit comments

Comments
 (0)