Skip to content

Commit

Permalink
revert formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejpurves committed Feb 20, 2024
1 parent 3cff44b commit 01c241a
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions binderhub/static/js/src/form.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getPathType } from './path';
import { getPathType } from "./path";

/**
* Parse current values in form and return them with appropriate URL encoding
Expand All @@ -11,32 +11,32 @@ import { getPathType } from './path';
* @returns {}
*/
export function getBuildFormValues() {
const providerPrefix = $('#provider_prefix').val().trim();
let repo = $('#repository').val().trim();
if (providerPrefix !== 'git') {
repo = repo.replace(/^(https?:\/\/)?gist.github.com\//, '');
repo = repo.replace(/^(https?:\/\/)?github.com\//, '');
repo = repo.replace(/^(https?:\/\/)?gitlab.com\//, '');
const providerPrefix = $("#provider_prefix").val().trim();
let repo = $("#repository").val().trim();
if (providerPrefix !== "git") {
repo = repo.replace(/^(https?:\/\/)?gist.github.com\//, "");
repo = repo.replace(/^(https?:\/\/)?github.com\//, "");
repo = repo.replace(/^(https?:\/\/)?gitlab.com\//, "");
}
// trim trailing or leading '/' on repo
repo = repo.replace(/(^\/)|(\/?$)/g, '');
// trim trailing or leading "/" on repo
repo = repo.replace(/(^\/)|(\/?$)/g, "");
// git providers encode the URL of the git repository as the repo
// argument.
if (repo.includes('://') || providerPrefix === 'gl') {
if (repo.includes("://") || providerPrefix === "gl") {
repo = encodeURIComponent(repo);
}

let ref = $('#ref').val().trim() || $('#ref').attr('placeholder');
let ref = $("#ref").val().trim() || $("#ref").attr("placeholder");
if (
providerPrefix === 'zenodo' ||
providerPrefix === 'figshare' ||
providerPrefix === 'dataverse' ||
providerPrefix === 'hydroshare' ||
providerPrefix === 'meca'
providerPrefix === "zenodo" ||
providerPrefix === "figshare" ||
providerPrefix === "dataverse" ||
providerPrefix === "hydroshare" ||
providerPrefix === "meca"
) {
ref = '';
ref = "";
}
const path = $('#filepath').val().trim();
const path = $("#filepath").val().trim();
return {
providerPrefix: providerPrefix,
repo: repo,
Expand Down

0 comments on commit 01c241a

Please sign in to comment.