Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed JSON not being written to file #1158

Merged
merged 2 commits into from Mar 29, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+28 −5
Diff settings

Always

Just for now

@@ -14,4 +14,4 @@
/data
/coverage
/node_modules
/npm-debug.log
/npm-debug.log
@@ -1,4 +1,5 @@
const { join, dirname } = require('path')
const intoStream = require('into-stream')
const url = require('url')
const fs = require('fs')
const $rdf = require('rdflib')
@@ -160,6 +161,13 @@ class LDP {
}
const { url: putUrl, contentType } = await this.resourceMapper.mapFileToUrl(
{ path: this.resourceMapper.rootPath + resourcePath, hostname: host })

// HACK: the middleware in webid-oidc.js uses body-parser, thus ending the stream of data
// for JSON bodies. So, the stream needs to be reset
if (contentType.includes('application/json')) {
stream = intoStream(JSON.stringify(stream.body))
}

await ldp.put(putUrl, stream, contentType)
return originalPath
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -55,8 +55,8 @@
"homepage": "https://github.com/solid/node-solid-server",
"bugs": "https://github.com/solid/node-solid-server/issues",
"dependencies": {
"@solid/oidc-auth-manager": "^0.17.1",
"@solid/acl-check": "^0.2.0",
"@solid/oidc-auth-manager": "^0.17.1",
"body-parser": "^1.18.3",
"bootstrap": "^3.3.7",
"busboy": "^0.2.12",
@@ -79,6 +79,7 @@
"handlebars": "^4.0.13",
"http-proxy-middleware": "^0.18.0",
"inquirer": "^1.0.2",
"into-stream": "^5.0.0",
"ip-range-check": "0.0.2",
"is-ip": "^2.0.0",
"li": "^1.0.1",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.