(serialized)
| 203 | const resourceSym = graph.sym(resource.url) |
| 204 | |
| 205 | function doWrite (serialized) { |
| 206 | // First check if we are above quota |
| 207 | overQuota(root, serverUri).then((isOverQuota) => { |
| 208 | if (isOverQuota) { |
| 209 | return reject(error(413, |
| 210 | 'User has exceeded their storage quota')) |
| 211 | } |
| 212 | |
| 213 | fs.writeFile(resource.path, serialized, { encoding: 'utf8' }, function (err) { |
| 214 | if (err) { |
| 215 | return reject(error(500, `Failed to write file after patch: ${err}`)) |
| 216 | } |
| 217 | debug('PATCH -- applied successfully') |
| 218 | resolve('Patch applied successfully.\n') |
| 219 | }) |
| 220 | }).catch(() => reject(error(500, 'Error finding user quota'))) |
| 221 | } |
| 222 | |
| 223 | if (resource.contentType === 'application/ld+json') { |
| 224 | $rdf.serialize(resourceSym, graph, resource.url, resource.contentType, function (err, result) { |
no test coverage detected