Skip to content

Commit

Permalink
fix: URI values cannot have whitespace
Browse files Browse the repository at this point in the history
Use encodeURI to parse URL string
  • Loading branch information
Chinlinlee committed Oct 28, 2021
1 parent 7712dc2 commit e3096e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions models/FHIR/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ function createBundle (req , docs , count , skip , limit , resource , option) {
if (bundle.total == 0) {
delete bundle.entry;
}
for (let index in bundle.link) {
let link = bundle.link[index];
link.url = encodeURI(link.url);
}
return bundle;
}

Expand Down
3 changes: 3 additions & 0 deletions models/mongodb/FHIRDataTypesSchema/uri.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ module.exports = {
},
message: props => `${props.value} is not a valid uri!`
},
get : function(v) {
return encodeURI(v);
},
default: void 0
}
3 changes: 3 additions & 0 deletions models/mongodb/FHIRDataTypesSchema/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ module.exports = {
},
message: props => `${props.value} is not a valid url!`
},
get : function(v) {
return encodeURI(v);
},
default: void 0
}

0 comments on commit e3096e2

Please sign in to comment.