From 7153f73867e5d74eb5ea79767ee341c311ac1448 Mon Sep 17 00:00:00 2001 From: Richard Bradley Date: Tue, 24 May 2016 10:26:40 +0100 Subject: [PATCH] #1041 fix encoding of entity ids in REST URLs --- doc/reference/Entity.md | 3 ++- doc/reference/View.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/reference/Entity.md b/doc/reference/Entity.md index 2eb94faa..28c4cfb5 100644 --- a/doc/reference/Entity.md +++ b/doc/reference/Entity.md @@ -35,7 +35,8 @@ Defines the base API endpoint for all views of this entity Defines the API endpoint for all views of this entity. It can be a string or a function. var comment = nga.entity('comments').url(function(entityName, viewType, identifierValue, identifierName) { - return '/comments/' + entityName + '_' + viewType + '?' + identifierName + '=' + identifierValue; // Can be absolute or relative + var e = encodeURIComponent; + return '/comments/' + e(entityName) + '_' + e(viewType) + '?' + e(identifierName) + '=' + e(identifierValue); // Can be absolute or relative }); * `createMethod(string)` and `updateMethod(string)` diff --git a/doc/reference/View.md b/doc/reference/View.md index 3656959d..d95517fd 100644 --- a/doc/reference/View.md +++ b/doc/reference/View.md @@ -55,7 +55,7 @@ Disable this view. Useful e.g. to disable views that modify data and only leave Defines the API endpoint for a view. It can be a string or a function. comment.listView().url(function(entityId) { - return '/comments/id/' + entityId; // Can be absolute or relative + return '/comments/id/' + encodeURIComponent(entityId); // Can be absolute or relative }); ## listView Settings