Skip to content

Fix repo/path-matching regex - #66

Open
aadrian wants to merge 4 commits into
gitbucket:masterfrom
aadrian:pr-fix-path-matching
Open

aadrian wants to merge 4 commits into
gitbucket:masterfrom
aadrian:pr-fix-path-matching

Conversation

@aadrian

@aadrian aadrian commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Fixes the URL-matching regex so repositories named signin, dashboard, admin or groups work, and anchors it after the servlet context path as suggested in the review. Adds PluginSpec.

Comment thread src/main/scala/Plugin.scala Outdated
val path = settings.baseUrl.getOrElse(context.getContextPath)
Seq(
".*/(?!.*(signin|dashboard|admin)).+/.+" -> s"""
"(?!/(?:signin|dashboard|admin)(?:/|$)).+/.+" -> s"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand the current problem that the explorer plugin doesn't work for repositories that contain /signin, /dashboard and /admin. However, this change could wrongly inject CSS/JavaScript when GitBucket is installed under the context path.

Maybe we should include the context path in the regular expression?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@takezoe the further commit should handle context path too.

There's also an alternative PR , #73 (kind of a "hack" ) since that place is not optimal, however this way no regexp is needed, since it will be inserted only where needed.

However, IMO a better solution would be to allow plug-ins to handle assets better (but that would require some GitHub changes: please see https://github.com/aadrian/gitbucket-explorer-plugin/wiki/Plugin-asset-extension-point

Thank you.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants