Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
None
-
Security Level: Public
-
None
Description
When looking at a view created via the Java SDK in the web admin, the "Show Results" button is greyed out when the map or reduce function contain a carriage return. The view can be executed via the SDK as well as the REST interface, but the "Show Results" button is disabled.
This was reported in the forums over a year ago:
http://www.couchbase.com/forums/thread/design-docs-views-created-rest-api-dont-work-show-results-grayed-out-404-error-client
I can't find a ticket for it and it doesn't appear to be resolved.
As a work around, I am manually replacing carriage returns (CFML code)
/**
|
* Normalize view functions to not have any carridge returns.
|
* The presence of ASCII code 13 in map or reduce functions will prevent you from
|
* being able to execute them from the Couchbase web admin.
|
* @viewFunction.hint The function string to normalize
|
*/
|
string function normalizeViewFunction( required string viewFunction ) {
|
var CR = chr(13);
|
var LF = chr(10);
|
var CRLF = CR & LF;
|
var CRLFPlaceholder = '__CRLF__';
|
|
// I'm doing this in two steps since if I just remove CR's that have no LF, that would completely remove line breaks and cause syntax issues
|
// but if I just replaced all CR's with LF's that would double all line breaks. Therefore, all CR's and CRLF's will be converted to an LF.
|
// Standalone LF's won't be touched.
|
|
// Set CRLF's aside for a moment
|
arguments.viewFunction = replace(arguments.viewFunction,CRLF,CRLFPlaceholder,'all');
|
// Replace single CR's with LF's
|
arguments.viewFunction = replace(arguments.viewFunction,CR,LF,'all');
|
// Put the CRLF's back as just LF's
|
arguments.viewFunction = replace(arguments.viewFunction,CRLFPlaceholder,LF,'all');
|
|
return arguments.viewFunction;
|
}
|
Attachments
Issue Links
- relates to
-
MB-11275 Views created over REST API with CRLF cannot be looked at from the UI
- Resolved