This is an automated email from the ASF dual-hosted git repository.
garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
The following commit(s) were added to refs/heads/master by this push:
new 1dd3a8b (#924) - Fix table for url with special char in password
1dd3a8b is described below
commit 1dd3a8b2eed505f37b8ff877e738d253aacf3042
Author: garren smith <[email protected]>
AuthorDate: Mon May 15 13:53:20 2017 +0200
(#924) - Fix table for url with special char in password
Fixes an issue where the replication activity table wouldn't render if a
url had a password with a special character in it
---
.../replication/__tests__/common-table.test.js | 32 ++++++++++++++++++++++
app/addons/replication/components/common-table.js | 5 ++--
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/app/addons/replication/__tests__/common-table.test.js
b/app/addons/replication/__tests__/common-table.test.js
new file mode 100644
index 0000000..d7850e1
--- /dev/null
+++ b/app/addons/replication/__tests__/common-table.test.js
@@ -0,0 +1,32 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
under
+// the License.
+import utils from "../../../../test/mocha/testUtils";
+import { shallow } from 'enzyme';
+import {formatUrl} from '../components/common-table';
+
+const {assert} = utils;
+
+describe('Common Table Component', () => {
+ describe("formatUrl", () => {
+ it("renders a url with tricky password characters", () => {
+ const url = "http://hello:h#$!^@couchdb.com/my-db";
+ const el = shallow(formatUrl(url));
+ assert.equal(el.find('a').prop('href'), '#/database/my-db/_all_docs');
+ });
+
+ it("renders a url with no password characters", () => {
+ const url = "http://couchdb.com/my-db";
+ const el = shallow(formatUrl(url));
+ assert.equal(el.find('a').prop('href'), '#/database/my-db/_all_docs');
+ });
+ });
+});
diff --git a/app/addons/replication/components/common-table.js
b/app/addons/replication/components/common-table.js
index fa760fd..0a8d622 100644
--- a/app/addons/replication/components/common-table.js
+++ b/app/addons/replication/components/common-table.js
@@ -13,9 +13,10 @@ import React from 'react';
import {Table, Tooltip, OverlayTrigger} from "react-bootstrap";
import moment from 'moment';
import {ErrorModal} from './modals';
+import {removeCredentialsFromUrl} from '../api';
-const formatUrl = (url) => {
- const urlObj = new URL(url);
+export const formatUrl = (url) => {
+ const urlObj = new URL(removeCredentialsFromUrl(url));
const encoded = encodeURIComponent(urlObj.pathname.slice(1));
if (url.indexOf(window.location.hostname) > -1) {
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].