Skip to content

Commit 91e51a5

Browse files
committed
fix paths
1 parent 32bf9e3 commit 91e51a5

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

packages/editor/src/app/documentRenderers/project/ProjectContainer.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,12 @@ const ProjectContainer = observer((props: Props) => {
172172
// TODO: hardcoded fix for docs
173173
path = identifiersToPath([
174174
new HttpsIdentifier(
175-
uri.URI.parse(window.location.protocol + "//" + window.location.host + "/_docs/")
175+
uri.URI.parse(
176+
window.location.protocol +
177+
"//" +
178+
window.location.host +
179+
"/_docs/"
180+
)
176181
),
177182
// props.project.identifier,
178183
item.data.identifier,

packages/editor/src/app/routes/document.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ export const DocumentRoute = observer(
2121
return <div>Loading</div>;
2222
}
2323

24-
const [owner, workspace, ...documentParts] = location.pathname
24+
const [owner, workspace, ...documentParts] = decodeURIComponent(
25+
location.pathname
26+
)
2527
.substring(1)
2628
.split("/");
2729
const document = documentParts.join("/");
2830

2931
if (!owner || owner.length < 2 || !owner.startsWith("@")) {
30-
const identifiers = tryPathToIdentifiers(location.pathname.substring(1));
32+
const identifiers = tryPathToIdentifiers(
33+
decodeURIComponent(location.pathname).substring(1)
34+
);
3135
if (identifiers !== "invalid-identifier") {
3236
const [id, ...subs] = identifiers;
3337
return (

packages/editor/src/app/routes/ownerAlias.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ export const OwnerAliasRoute = observer(
204204
);
205205
}
206206

207-
const identifiers = pathToIdentifiers(location.pathname.substring(1));
207+
const identifiers = pathToIdentifiers(
208+
decodeURIComponent(location.pathname).substring(1)
209+
);
208210
const [id, ...subs] = identifiers;
209211
return (
210212
<RouteContext.Provider

packages/editor/src/identifiers/paths/identifierPathHelpers.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,8 @@ export function getIdentifierWithAppendedPath(
210210
pathToAppend: string
211211
): Identifier {
212212
const uri = identifier.uri.with({
213-
path: path.join(
214-
identifier.uri.path || "/",
215-
encodeURIComponent(pathToAppend)
216-
),
213+
path: path.join(identifier.uri.path || "/", pathToAppend),
217214
});
218-
219215
return parseUriIdentifier(uri);
220216
}
221217

0 commit comments

Comments
 (0)