You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by am...@apache.org on 2021/09/10 13:42:50 UTC
[couchdb-fauxton] branch main updated: Replace safeURLName usage
(#1320)
This is an automated email from the ASF dual-hosted git repository.
amaranhao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
The following commit(s) were added to refs/heads/main by this push:
new 09e9f93 Replace safeURLName usage (#1320)
09e9f93 is described below
commit 09e9f9353c766e249d2897c0b6512d01d8ff5998
Author: Deepak Chethan <de...@outlook.com>
AuthorDate: Fri Sep 10 19:12:43 2021 +0530
Replace safeURLName usage (#1320)
---
app/addons/documents/index-editor/components/IndexEditor.js | 4 +---
app/addons/documents/resources.js | 3 +--
app/addons/search/components/SearchIndexEditor.js | 3 +--
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/app/addons/documents/index-editor/components/IndexEditor.js b/app/addons/documents/index-editor/components/IndexEditor.js
index b2a14bf..1ffafae 100644
--- a/app/addons/documents/index-editor/components/IndexEditor.js
+++ b/app/addons/documents/index-editor/components/IndexEditor.js
@@ -101,9 +101,7 @@ export default class IndexEditor extends Component {
if (this.props.designDocId === 'new-doc' || this.props.isNewView) {
return '#' + FauxtonAPI.urls('allDocs', 'app', encodedDatabase, encodedPartitionKey);
}
- const encodedDDoc = this.props.designDocId.startsWith('_design/') ?
- '_design/' + encodeURIComponent(this.props.designDocId.substring(8)) :
- encodeURIComponent(this.props.designDocId);
+ const encodedDDoc = app.utils.getSafeIdForDoc(this.props.designDocId);
const encodedView = encodeURIComponent(this.props.viewName);
return '#' + FauxtonAPI.urls('view', 'showView', encodedDatabase, encodedPartitionKey, encodedDDoc, encodedView);
}
diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js
index a920b8e..bb44518 100644
--- a/app/addons/documents/resources.js
+++ b/app/addons/documents/resources.js
@@ -64,8 +64,7 @@ Documents.DdocInfo = FauxtonAPI.Model.extend({
// treated separately. For instance, we could default into the
// json editor for docs, or into a ddoc specific page.
safeID: function () {
- var ddoc = this.id.replace(/^_design\//, "");
- return "_design/" + app.utils.safeURLName(ddoc);
+ return app.utils.getSafeIdForDoc(this.id);
}
});
diff --git a/app/addons/search/components/SearchIndexEditor.js b/app/addons/search/components/SearchIndexEditor.js
index dbff53a..825b656 100644
--- a/app/addons/search/components/SearchIndexEditor.js
+++ b/app/addons/search/components/SearchIndexEditor.js
@@ -96,8 +96,7 @@ export default class SearchIndexEditor extends React.Component {
return '#' + FauxtonAPI.urls('allDocs', 'app', encodedDatabase, encodedPartitionKey);
}
- const cleanDDocName = this.props.lastSavedDesignDocName.replace(/^_design\//, '');
- const encodedDDoc = '_design/' + encodeURIComponent(cleanDDocName);
+ const encodedDDoc = app.utils.getSafeIdForDoc(this.props.lastSavedDesignDocName);
const encodedIndex = encodeURIComponent(this.props.lastSavedSearchIndexName);
return '#' + FauxtonAPI.urls('search', 'showIndex', encodedDatabase,
encodedPartitionKey, encodedDDoc, encodedIndex);