Skip to content

Conversation

@TotomInc
Copy link

@TotomInc TotomInc commented Nov 7, 2025

  • Integrate GitLab OAuth support on route /auth/gitlab
    • New server route handler for /__nuxt_studio/auth/gitlab which points to /server/routes/auth/gitlab.get runtime method
    • Update /auth/admin to redirect to the proper provider as defined in the module config
  • Turn useGit into a shared composable, returns the proper git provider based on the module provider config
    • Added an abstract GitProvider interface
    • Add createGitLabProvider with methods to fetch, commit and push to remote repository
    • Updated createGitHubProvider with GitProvider abstract interface
    • This allows for easier implementation of Git providers in the future
    • Fetch GitLab files in base64, similar to GitHub provider
  • Add gitlab provider in user & module config
  • Add gitlab.applicationId, gitlab.applicationSecret and gitlab.instanceUrl module config properties with support for their own environment variables
  • Ensure encoding is properly set on each fetched file
    • Add ternaries to determine if base64 decode should be used based on the file encoding (base64 or utf-8)

See #65 for context (fixes #65)

What's missing

  • Test GitLab OAuth (working)
  • Test GitLab commit/push
  • Update studio front-end to be more agnostic toward Git providers
    • There's too much code specific to GitHub

@vercel
Copy link

vercel bot commented Nov 7, 2025

@TotomInc is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@TotomInc TotomInc marked this pull request as draft November 7, 2025 09:15
@TotomInc TotomInc changed the title draft: feat(oauth): gitlab support feat(oauth): gitlab support Nov 7, 2025
@TotomInc TotomInc force-pushed the feat/gitlab-integration branch from e83bdf9 to 963a4e7 Compare November 7, 2025 10:07
@TotomInc TotomInc marked this pull request as ready for review November 7, 2025 12:47
const localOriginal = props.draftItem.original ? await generateContentFromDocument(props.draftItem.original as DatabaseItem) : null
const gitHubOriginal = props.draftItem.githubFile?.content ? fromBase64ToUTF8(props.draftItem.githubFile.content) : null
const gitHubOriginal = props.draftItem.remoteFile?.content ? fromBase64ToUTF8(props.draftItem.remoteFile.content) : null
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const gitHubOriginal = props.draftItem.remoteFile?.content ? fromBase64ToUTF8(props.draftItem.remoteFile.content) : null
const gitHubOriginal = props.draftItem.remoteFile?.content ? (props.draftItem.remoteFile.encoding === 'base64' ? fromBase64ToUTF8(props.draftItem.remoteFile.content) : props.draftItem.remoteFile.content) : null

The component doesn't check the encoding before base64-decoding content, which could fail if content has a different encoding than base64.

View Details

Analysis

Missing encoding check in ContentCardReview.vue causes base64 decode error

What fails: ContentCardReview.vue line 93 unconditionally calls fromBase64ToUTF8() on remoteFile.content without checking the encoding field, causing "Invalid character" errors when content has encoding: 'utf-8'

How to reproduce:

// Content with utf-8 encoding (common in test mocks and API responses)
const remoteFile = { content: '# Hello', encoding: 'utf-8' }
// ContentCardReview.vue line 93: fromBase64ToUTF8(remoteFile.content)
// Result: Error: Invalid character

Result: JavaScript error "Invalid character" when atob() attempts to decode non-base64 content

Expected: Should check remoteFile.encoding === 'base64' before calling fromBase64ToUTF8(), like ContentEditorCode.vue line 121 and draft.ts lines 19, 30 do correctly

@vercel
Copy link

vercel bot commented Nov 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
content-studio Ready Ready Preview Comment Nov 7, 2025 5:05pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for (self-hosted) GitLab

1 participant