Skip to content

Commit 59e4c00

Browse files
authored
More small fixes (#371)
* getAllProjects, convert to fetch semantics * fix the link from preview for subpath projects * forgot to commit the list of adapter projects
1 parent ca39c50 commit 59e4c00

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

frontend/components/Project/Preview.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ const description = getDescription()
5757
const parsedIdObj = Util.parseProjectId(project.id!)
5858
const org = parsedIdObj.owner
5959
const repo = parsedIdObj.repo
60-
const link = `/projects/${org}/${repo}/`
60+
const path = parsedIdObj.path;
61+
const pathPart = path ? `::${path.split("/").join("::")}` : ""
62+
const link = `/projects/${org}/${repo}${pathPart}`
6163
</script>
6264

6365
<style lang="scss" scoped>

functions/src/github.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -172,25 +172,25 @@ export class Github {
172172
const res = results ? results : [];
173173

174174
var that = this;
175-
return fetch(url, this.getFullOptions())
176-
.then(res => res.json())
177-
.then(response => {
178-
const data = response.body;
179-
const headers = response.headers;
180-
181-
const newResults = res.concat(data);
182-
183-
if (headers.link) {
184-
const linkHeader = parselh(headers.link);
185-
if (linkHeader.next) {
186-
return that.readAllPages(linkHeader.next.url, newResults);
187-
} else {
188-
return newResults;
189-
}
175+
return fetch(url, this.getFullOptions()).then(async response => {
176+
if (!response.ok) {
177+
console.error("Failed to fetch", url);
178+
return res;
179+
}
180+
const data = await response.json();
181+
const headers = response.headers;
182+
const newResults = res.concat(data);
183+
if (headers.get("link")) {
184+
const linkHeader = parselh(headers.get("link"));
185+
if (linkHeader.next) {
186+
return that.readAllPages(linkHeader.next.url, newResults);
190187
} else {
191188
return newResults;
192189
}
193-
});
190+
} else {
191+
return newResults;
192+
}
193+
});
194194
}
195195

196196
/**

0 commit comments

Comments
 (0)