Skip to content

Commit 7b2f773

Browse files
committed
Remove byte units and the logic to support it. Also use anyValue method
1 parent e981aa5 commit 7b2f773

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

default-templates/new-account/settings/serverSide.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
dct:description "Administrative settings for the POD that the user can only read." .
1010

1111
</>
12-
solid:storageQuota "25"^^unit:megabyte .
12+
solid:storageQuota "25000000" .
1313

lib/utils.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ function routeResolvedFile (router, path, file, appendFileName = true) {
253253

254254
async function getQuota (root, serverUri) {
255255
const filename = path.join(root, 'settings/serverSide.ttl')
256-
var quota = Infinity
257256
var prefs
258257
try {
259258
prefs = await _asyncReadfile(filename)
@@ -268,24 +267,7 @@ async function getQuota (root, serverUri) {
268267
} catch (error) {
269268
throw new Error('Failed to parse serverSide.ttl, got ' + error)
270269
}
271-
const lit = graph.each($rdf.sym(storageUri), ns.solid('storageQuota'), undefined)[0]
272-
if (lit) {
273-
quota = lit.value
274-
const unitUri = 'http://www.w3.invalid/ns#'
275-
// The following should be encoded in the ontology
276-
switch (lit.datatype.value) {
277-
case unitUri + 'kilobyte':
278-
quota *= 1000
279-
break
280-
case unitUri + 'megabyte':
281-
quota *= 1000000
282-
break
283-
case unitUri + 'gigabyte':
284-
quota *= 1000000000
285-
break
286-
}
287-
}
288-
return quota
270+
return Number(graph.anyValue($rdf.sym(storageUri), ns.solid('storageQuota'))) || Infinity
289271
}
290272

291273
/**

test/resources/accounts-acl/config/templates/new-account/settings/serverSide.ttl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
dct:description "Administrative settings for the server that are only readable to the user." .
1010

1111
</>
12-
solid:storageQuota "2"^^unit:kilobyte .
12+
solid:storageQuota "2000" .
13+
1314

test/settings/serverSide.ttl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
dct:description "Administrative settings for the server that are only readable to the user." .
1010

1111
</>
12-
solid:storageQuota "1230"^^unit:kilobyte .
12+
solid:storageQuota "1230" .
13+
1314

0 commit comments

Comments
 (0)