Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitutil: strip SSH port from submodule URL when rendering for HTML link #7383

Merged
merged 5 commits into from
Mar 5, 2023

Conversation

TheDarkUndoing
Copy link
Contributor

@TheDarkUndoing TheDarkUndoing commented Mar 1, 2023

Describe the pull request

This is the bug fix for #4941

Link to the issue: fixes #4941 (comment)

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code or have provided the test plan.

Test plan

@TheDarkUndoing
Copy link
Contributor Author

@unknwon could you take a look at this, I want to make sure the changes effect the front end, is there a CICD workflow for me to test a build with my changes?

@unknwon
Copy link
Member

unknwon commented Mar 2, 2023

@unknwon could you take a look at this, I want to make sure the changes effect the front end, is there a CICD workflow for me to test a build with my changes?

I just approved the CI jobs for this PR. Will take a closer at the code this week if all checks passed, thank you!

@codecov
Copy link

codecov bot commented Mar 2, 2023

Codecov Report

Merging #7383 (a7f5c52) into main (689e71f) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7383   +/-   ##
=======================================
  Coverage   14.63%   14.63%           
=======================================
  Files         108      108           
  Lines       13880    13880           
=======================================
  Hits         2032     2032           
  Misses      11575    11575           
  Partials      273      273           

@TheDarkUndoing
Copy link
Contributor Author

TheDarkUndoing commented Mar 2, 2023

@unknwon could you take a look at this, I want to make sure the changes effect the front end, is there a CICD workflow for me to test a build with my changes?

I just approved the CI jobs for this PR. Will take a closer at the code this week if all checks passed, thank you!

Looks like the lint failed, I formatted and commited the change. Ready for CI job to be run again.

@unknwon unknwon changed the title fixed submodule url gitutil: strip SSH port from submodule URL when rendering for HTML link Mar 5, 2023
Copy link
Member

@unknwon unknwon left a comment

Choose a reason for hiding this comment

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

Thank you!

@unknwon unknwon merged commit 5483d97 into gogs:main Mar 5, 2023
@TheDarkUndoing
Copy link
Contributor Author

This doesn't fix when a host has a port. The change I made would fix this. Your simpler solution does not fix this.

@TheDarkUndoing
Copy link
Contributor Author

@unknwon Can we reopen this to properly address the bug?

@unknwon
Copy link
Member

unknwon commented Mar 11, 2023

@TheDarkUndoing My bad, will take another look!

@TheDarkUndoing
Copy link
Contributor Author

@unknwon my original change should address the issue

@unknwon
Copy link
Member

unknwon commented Mar 18, 2023

This doesn't fix when a host has a port.

@TheDarkUndoing - what is an example of "a host has a port"?

@TheDarkUndoing
Copy link
Contributor Author

TheDarkUndoing commented Mar 18, 2023

For an example the gogs server is hosted on port 8080. The url for the host is {gogs host}:8080. I dont think there is a way to retain the port when parsing an ssh url with the way submodule.go is written. I think the baseUrl host does not retain the port number if it isn't hosted on port 80. It is written assuming that port 80 is the only port that would be hosting gogs

@unknwon
Copy link
Member

unknwon commented Mar 19, 2023

For an example the gogs server is hosted on port 8080. The url for the host is {gogs host}:8080. I dont think there is a way to retain the port when parsing an ssh url with the way submodule.go is written. I think the baseUrl host does not retain the port number if it isn't hosted on port 80. It is written assuming that port 80 is the only port that would be hosting gogs

Yes, but how is your original version handles it? Here we are only dealing with ssh:// urls, there is no information to tell whether the http:// should have a port or not. 🤔

@TheDarkUndoing
Copy link
Contributor Author

after reviewing my last change, I was wrong my changes dont effect that. I think we would need some kind of "global" variable or env that holds the proper host URL. That may already exist, I havent checked.

@unknwon
Copy link
Member

unknwon commented Mar 21, 2023

after reviewing my last change, I was wrong my changes dont effect that. I think we would need some kind of "global" variable or env that holds the proper host URL. That may already exist, I havent checked.

Top off my head I think having a pre-defined "global" list is suboptimal, it is unpractical to know the host URL info ahead of time. I think extend the .gitmodules to include a non-SSH URL would be better (not final).


Since the new issue is unrelated to this thread, I'd recommend to file a new issue to address that (if we want to).

dna2github pushed a commit to dna2fork/gogs that referenced this pull request May 1, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Submodule with 'ssh:// method' and alternate port breaks hyperlink in webui
2 participants