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
docUri: string,
59
publication?: PublicationInput | NormalizedPublication | null,
60
): string {
61
-
const path = doc.path || "/" + new AtUri(docUri).rkey;
0
62
const aturi = new AtUri(docUri);
63
64
const isNormalized =
65
!!publication &&
66
-
(publication as NormalizedPublication).$type === "site.standard.publication";
0
67
const normPub = isNormalized
68
? (publication as NormalizedPublication)
69
: publication
70
? normalizePublicationRecord((publication as PublicationInput).record)
71
: null;
72
-
const pubInput = isNormalized ? null : (publication as PublicationInput | null);
0
0
73
74
// Non-leaflet documents always use the full publication site URL
75
if (doc.content && !hasLeafletContent(doc) && normPub?.url) {
···
58
docUri: string,
59
publication?: PublicationInput | NormalizedPublication | null,
60
): string {
61
+
let path = doc.path || "/" + new AtUri(docUri).rkey;
62
+
if (path[0] !== "/") path = "/" + path;
63
const aturi = new AtUri(docUri);
64
65
const isNormalized =
66
!!publication &&
67
+
(publication as NormalizedPublication).$type ===
68
+
"site.standard.publication";
69
const normPub = isNormalized
70
? (publication as NormalizedPublication)
71
: publication
72
? normalizePublicationRecord((publication as PublicationInput).record)
73
: null;
74
+
const pubInput = isNormalized
75
+
? null
76
+
: (publication as PublicationInput | null);
77
78
// Non-leaflet documents always use the full publication site URL
79
if (doc.content && !hasLeafletContent(doc) && normPub?.url) {