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

Support relative paths to videos from Wiki pages #31061

Merged
merged 5 commits into from
Jun 21, 2024

Conversation

sergeyvfx
Copy link
Contributor

This change fixes cases when a Wiki page refers to a video stored in the Wiki repository using relative path. It follows the similar case which has been already implemented for images.

Test plan:

  • Create repository and Wiki page
  • Clone the Wiki repository
  • Add video to it, say video.mp4
  • Modify the markdown file to refer to the video using <video src="video.mp4">
  • Commit the Wiki page
  • Observe that the video is properly displayed

This change fixes cases when a Wiki page refers to a video stored
in the Wiki repository using relative path. It follows the similar
case which has been already implemented for images.

Test plan:
- Create repository and Wiki page
- Clone the Wiki repository
- Add video to it, say `video.mp4`
- Modify the markdown file to refer to the video using `<video src="video.mp4">`
- Commit the Wiki page
- Observe that the video is properly displayed
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 23, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 23, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label May 23, 2024
@lunny lunny added the type/enhancement An improvement of existing functionality label May 23, 2024
@lunny lunny added this to the 1.23.0 milestone May 23, 2024
@Mets3D
Copy link

Mets3D commented Jun 18, 2024

I would really appreciate this getting merged. ReadMe pages can be a lot more attractive with some video embeds of use cases, and using absolute paths for those sucks big time, eg. when working on a branch. Thanks for the patch, Sergey.

@wxiaoguang
Copy link
Contributor

I will take a look (resolve conflicts and improve and approve)

@wxiaoguang wxiaoguang self-assigned this Jun 19, 2024
# Conflicts:
#	modules/markup/html.go
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 20, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 20, 2024
@wxiaoguang
Copy link
Contributor

Did some changes:

  1. Make video function shares some logic from img and put them in a separate file to avoid bloating html.go
  2. Use similar tests as img and add a case for "absolute path"

@wxiaoguang wxiaoguang added the backport/v1.22 This PR should be backported to Gitea 1.22 label Jun 20, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 21, 2024
@techknowlogick techknowlogick enabled auto-merge (squash) June 21, 2024 17:55
@techknowlogick techknowlogick added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 21, 2024
@techknowlogick techknowlogick merged commit 49b8716 into go-gitea:main Jun 21, 2024
26 checks passed
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Jun 21, 2024
This change fixes cases when a Wiki page refers to a video stored in the
Wiki repository using relative path. It follows the similar case which
has been already implemented for images.

Test plan:
- Create repository and Wiki page
- Clone the Wiki repository
- Add video to it, say `video.mp4`
- Modify the markdown file to refer to the video using `<video
src="video.mp4">`
- Commit the Wiki page
- Observe that the video is properly displayed

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@GiteaBot GiteaBot added backport/done All backports for this PR have been created and removed reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. labels Jun 21, 2024
lafriks pushed a commit that referenced this pull request Jun 21, 2024
Backport #31061 by @sergeyvfx

This change fixes cases when a Wiki page refers to a video stored in the
Wiki repository using relative path. It follows the similar case which
has been already implemented for images.

Test plan:
- Create repository and Wiki page
- Clone the Wiki repository
- Add video to it, say `video.mp4`
- Modify the markdown file to refer to the video using `<video
src="video.mp4">`
- Commit the Wiki page
- Observe that the video is properly displayed

Co-authored-by: Sergey Sharybin <sergey.vfx@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@Mets3D
Copy link

Mets3D commented Jun 21, 2024

Much appreciated, mate!

zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 22, 2024
* giteaofficial/main:
  Refactor image diff (go-gitea#31444)
  [skip ci] Updated translations via Crowdin
  Support relative paths to videos from Wiki pages (go-gitea#31061)
  Fix deprecated Dockerfile ENV format (go-gitea#31450)
  README Badge maintenance (go-gitea#31441)
  Improve markdown textarea for indentation and lists (go-gitea#31406)
  Split common-global.js into separate files (go-gitea#31438)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/done All backports for this PR have been created backport/v1.22 This PR should be backported to Gitea 1.22 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants