Skip to content

Commit 64f4394

Browse files
committed
fix issue with module names having /
1 parent 02c6746 commit 64f4394

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

prember-urls.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ const { readdirSync, readFileSync } = require('fs');
22
const cmp = require('semver-compare');
33
const semver = require('semver');
44

5+
function partialUrlEncode(input) {
6+
return input.replace('/', '%2F');
7+
}
8+
59
module.exports = function () {
610
const projects = readdirSync('ember-api-docs-data/json-docs');
711

@@ -67,9 +71,19 @@ module.exports = function () {
6771
urls.push(`/${p}/${uniqVersion}/${entity}/${cleanId}`);
6872

6973
// TODO only include sub routes if that entity has stuff in that route i.e. if it's empty don't pre-render it
70-
urls.push(`/${p}/${uniqVersion}/${entity}/${cleanId}/methods`);
71-
urls.push(`/${p}/${uniqVersion}/${entity}/${cleanId}/properties`);
72-
urls.push(`/${p}/${uniqVersion}/${entity}/${cleanId}/events`);
74+
urls.push(
75+
`/${p}/${uniqVersion}/${entity}/${partialUrlEncode(
76+
cleanId
77+
)}/methods`
78+
);
79+
urls.push(
80+
`/${p}/${uniqVersion}/${entity}/${partialUrlEncode(
81+
cleanId
82+
)}/properties`
83+
);
84+
urls.push(
85+
`/${p}/${uniqVersion}/${entity}/${partialUrlEncode(cleanId)}/events`
86+
);
7387

7488
if (entity === 'modules') {
7589
// id is
@@ -93,9 +107,8 @@ module.exports = function () {
93107

94108
listOfFunctions.forEach((func) => {
95109
urls.push(
96-
`/${p}/${uniqVersion}/functions/${cleanId.replace(
97-
'/',
98-
'%2F'
110+
`/${p}/${uniqVersion}/functions/${partialUrlEncode(
111+
cleanId
99112
)}/${func.name}`
100113
);
101114
});

0 commit comments

Comments
 (0)