Making WordPress.org

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#6538 closed defect (bug) (fixed)

wporg-markdown importer - Support GitHub branches not named `master`

Reported by: netweb Owned by: dd32
Priority: normal Milestone:
Component: Handbooks Keywords:
Cc:

Description

Currently the get_markdown_edit_link() function hard codes the GitHub edit link to master: (​Source)

		if ( 'github.com' !== parse_url( $markdown_source, PHP_URL_HOST )
			|| false !== stripos( $markdown_source, '/edit/master/' ) ) {
			return $markdown_source;
		}
		$markdown_source = str_replace( '/blob/master/', '/edit/master/', $markdown_source );

Discovered after merging ​https://github.com/WordPress/WordPress-Documentation-Style-Guide/pull/20 where the default branch is main, prior to merging the above PR the GitHub "edit" URL on pages were in the form:

The above URL format 404s as the master branch no longer exists on GitHub

The new "edit" URL on pages is:

And as such the URL doesn't include /edit/main, just /main, so the URL opens correctly just not in the previous "edit" mode.

My suggestion would be to update the above function to account for common dotorg repo branch names used: trunk, main, and master

Change History (3)

This ticket was mentioned in ​Slack in #docs by netweb. ​View the logs.


4 years ago

#2 @dd32
4 years ago

  • Owner set to dd32
  • Resolution → fixed
  • Status new → closed

In 12118:

Markdown Importer: Support any branch in the imported content, not just master.

Fixes #6538.

#3 @dd32
4 years ago

  • Component WordPress.org Site → Handbooks
Note: See TracTickets for help on using tickets.