@lvce-editor/title-bar-worker 4.13.0 → 4.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,3 @@ cd text-search-worker &&
10
10
  npm ci &&
11
11
  npm test
12
12
  ```
13
-
14
- ## Gitpod
15
-
16
- [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvce-editor/title-bar-worker)
@@ -3777,15 +3777,23 @@ const parseTitleTemplate = (template, folderName, appName) => {
3777
3777
  return template.replaceAll('${folderName}', () => folderName).replaceAll('${appName}', () => appName);
3778
3778
  };
3779
3779
 
3780
+ const getEndIndex = workspaceUri => {
3781
+ let endIndex = workspaceUri.length;
3782
+ while (endIndex > 0 && workspaceUri[endIndex - 1] === '/') {
3783
+ endIndex--;
3784
+ }
3785
+ return endIndex;
3786
+ };
3780
3787
  const getTitle = (workspaceUri, titleTemplate, appName) => {
3781
3788
  if (!workspaceUri) {
3782
3789
  return '';
3783
3790
  }
3784
- const slashIndex = workspaceUri.lastIndexOf('/');
3791
+ const endIndex = getEndIndex(workspaceUri);
3792
+ const slashIndex = workspaceUri.lastIndexOf('/', endIndex - 1);
3785
3793
  if (slashIndex === -1) {
3786
3794
  return '';
3787
3795
  }
3788
- const folderName = workspaceUri.slice(slashIndex + 1);
3796
+ const folderName = workspaceUri.slice(slashIndex + 1, endIndex);
3789
3797
 
3790
3798
  // If titleTemplate is empty, return folderName directly
3791
3799
  if (!titleTemplate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",