Skip to content

Commit 3132a48

Browse files
committed
Parse SPDX urls
1 parent d5d5691 commit 3132a48

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/lib/TempResolver.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const TS4TIBResponse = z.object({
1010
})
1111
})
1212

13+
const SPDX_LICENSE_REGEX = /https:\/\/spdx\.org\/licenses\/(.*)\.json/
14+
1315
export class TempResolver {
1416
async resolvePurl(url: string) {
1517
try {
@@ -30,9 +32,8 @@ export class TempResolver {
3032

3133
async resolveSpdx(url: string) {
3234
try {
33-
const result = await fetch(url)
34-
const data = await result.json()
35-
console.log(data)
35+
const match = SPDX_LICENSE_REGEX.exec(url)
36+
return match ? match[1] : null
3637
} catch (e) {
3738
console.error(e)
3839
return url

src/stories/FairDOElasticSearch.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export const GenericResultRenderer: Story = {
185185
{
186186
icon: <ScaleIcon className="rfs-shrink-0 rfs-size-4 rfs-mr-2" />,
187187
field: "licenseURL",
188-
singleValueMapper: (v) => tryURLPrettyPrint(v),
188+
singleValueMapper: (v) => <PidDisplay pid={v} />,
189189
label: "License URL"
190190
},
191191
{

0 commit comments

Comments
 (0)