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

Fix URL copied via right click menu #4690

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ function runApp() {
const path = urlParts[1]

if (path) {
visible = ['/playlist', '/channel', '/watch'].some(p => path.startsWith(p))
visible = ['/channel', '/watch'].some(p => path.startsWith(p)) ||
// Only show copy link entry for non user playlists
(path.startsWith('/playlist') && !/playlistType=user/.test(path))
}
} else {
visible = true
Expand Down Expand Up @@ -103,17 +105,17 @@ function runApp() {
let url

if (toYouTube) {
url = `https://youtu.be/${id}`
url = new URL(`https://youtu.be/${id}`)
} else {
url = `https://redirect.invidious.io/watch?v=${id}`
url = new URL(`https://redirect.invidious.io/watch?v=${id}`)
}

if (query) {
const params = new URLSearchParams(query)
const newParams = new URLSearchParams()
const newParams = new URLSearchParams(url.search)
let hasParams = false

if (params.has('playlistId')) {
if (params.has('playlistId') && params.get('playlistType') !== 'user') {
newParams.set('list', params.get('playlistId'))
hasParams = true
}
Expand All @@ -124,11 +126,11 @@ function runApp() {
}

if (hasParams) {
url += '?' + newParams.toString()
url.search = newParams.toString()
}
}

return url
return url.toString()
}
}
}
Expand Down
Loading