Github user millayr commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/862#discussion_r102475029
  
    --- Diff: app/addons/replication/api.js ---
    @@ -41,6 +42,38 @@ export const getAuthHeaders = (username, password) => {
       };
     };
     
    +export const getCredentialsFromUrl = (url) => {
    +  const index = url.lastIndexOf('@');
    +  if (index === -1) {
    +    return {
    +      username: '',
    +      password: ''
    +    };
    +  }
    +
    +  const startIndex = url.startsWith("https") ? 8 : 7;
    +  const rawCreds = url.slice(startIndex, index);
    +  const colonIndex = rawCreds.indexOf(':');
    +  const username = rawCreds.slice(0, colonIndex);
    +  const password = rawCreds.slice(colonIndex + 1, rawCreds.length);
    +
    +  return {
    +    username,
    +    password
    +  };
    +};
    +
    +export const removeCredentialsFromUrl = (url) => {
    +  const index = url.lastIndexOf('@');
    +  if (index === -1) {
    +    return url;
    +  }
    +
    +  const protocal = url.startsWith("https") ? "https://"; : 'http://';
    --- End diff --
    
    protoc_o_l :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to