diff --git a/pephub/dependencies.py b/pephub/dependencies.py index 08cbcc7c..430810a5 100644 --- a/pephub/dependencies.py +++ b/pephub/dependencies.py @@ -162,6 +162,8 @@ def get_organizations_from_session_info( organizations = [] if session_info: organizations = session_info.get("orgs") + if organizations: + organizations = [x.lower() for x in organizations] return organizations @@ -171,6 +173,8 @@ def get_user_from_session_info( user = None if session_info: user = session_info.get("login") + if user: + user = user.lower() return user @@ -186,6 +190,7 @@ def get_namespace_access_list( if user: access_rights.append(user) access_rights.extend(orgs) + access_rights = [x.lower() for x in access_rights] return access_rights else: return [] diff --git a/pephub/helpers.py b/pephub/helpers.py index ea1553d4..a12aa56d 100644 --- a/pephub/helpers.py +++ b/pephub/helpers.py @@ -47,7 +47,7 @@ def zip_pep(project: Dict[str, Any]) -> Response: project_name = config[NAME_KEY] if project[SAMPLE_RAW_DICT_KEY] is not None: - config[CFG_SAMPLE_TABLE_KEY] = ["sample_table.csv"] + config[CFG_SAMPLE_TABLE_KEY] = "sample_table.csv" content_to_zip["sample_table.csv"] = pd.DataFrame( project[SAMPLE_RAW_DICT_KEY] ).to_csv(index=False) diff --git a/pephub/routers/auth/base.py b/pephub/routers/auth/base.py index 6cfcee99..94b44726 100644 --- a/pephub/routers/auth/base.py +++ b/pephub/routers/auth/base.py @@ -165,11 +165,15 @@ def callback( "https://api.github.com/user", headers={"Authorization": f"Bearer {x['access_token']}"}, ).json() + if "login" in u: + u["login"] = u["login"].lower() organizations = requests.get( u["organizations_url"], headers={"Authorization": f"Bearer {x['access_token']}"}, ).json() + for org in organizations: + org["login"] = org["login"].lower() # encode the token token = CLIAuthSystem.jwt_encode_user_data( diff --git a/web/src/components/forms/project-upload-form.tsx b/web/src/components/forms/project-upload-form.tsx index 957ea08c..381de3b8 100644 --- a/web/src/components/forms/project-upload-form.tsx +++ b/web/src/components/forms/project-upload-form.tsx @@ -7,9 +7,9 @@ import { useSession } from '../../contexts/session-context'; import { useUploadMutation } from '../../hooks/mutations/useUploadMutation'; import { popFileFromFileList } from '../../utils/dragndrop'; import { GitHubAvatar } from '../badges/github-avatar'; +import { CombinedErrorMessage } from './components/combined-error-message'; import { FileDropZone } from './components/file-dropzone'; import { SchemaDropdown } from './components/schemas-databio-dropdown'; -import { CombinedErrorMessage } from './components/combined-error-message' interface FromFileInputs { is_private: boolean; @@ -106,29 +106,29 @@ export const ProjectUploadForm = ({ onHide, defaultNamespace }: Props) => { {...register('name', { required: { value: true, - message: "empty", + message: 'empty', }, pattern: { value: /^[a-zA-Z0-9_-]+$/, - message: "invalid", + message: 'invalid', }, })} /> :
- * Namespace and Project Name are required. A tag value of "default" will be supplied if the Tag input is left empty. +
+ * Namespace and Project Name are required. A tag value of "default" will be supplied if the Tag input is left + empty.