tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
27
pulls
pipelines
check if doc path has leading / and add if needed
awarm.space
1 month ago
5a7a4d32
5aaf7df8
+7
-3
1 changed file
expand all
collapse all
unified
split
app
lish
createPub
getPublicationURL.ts
+7
-3
app/lish/createPub/getPublicationURL.ts
···
58
58
docUri: string,
59
59
publication?: PublicationInput | NormalizedPublication | null,
60
60
): string {
61
61
-
const path = doc.path || "/" + new AtUri(docUri).rkey;
61
61
+
let path = doc.path || "/" + new AtUri(docUri).rkey;
62
62
+
if (path[0] !== "/") path = "/" + path;
62
63
const aturi = new AtUri(docUri);
63
64
64
65
const isNormalized =
65
66
!!publication &&
66
66
-
(publication as NormalizedPublication).$type === "site.standard.publication";
67
67
+
(publication as NormalizedPublication).$type ===
68
68
+
"site.standard.publication";
67
69
const normPub = isNormalized
68
70
? (publication as NormalizedPublication)
69
71
: publication
70
72
? normalizePublicationRecord((publication as PublicationInput).record)
71
73
: null;
72
72
-
const pubInput = isNormalized ? null : (publication as PublicationInput | null);
74
74
+
const pubInput = isNormalized
75
75
+
? null
76
76
+
: (publication as PublicationInput | null);
73
77
74
78
// Non-leaflet documents always use the full publication site URL
75
79
if (doc.content && !hasLeafletContent(doc) && normPub?.url) {