Skip to content

Fix: Properly quote tvg-id in M3U entries using %q#567

Merged
rabilrbl merged 1 commit into
JioTV-Go:developfrom
Arshit-Singhal-Official:bugfix/m3u-tvgid-channelid-mismatch
Jul 15, 2025
Merged

Fix: Properly quote tvg-id in M3U entries using %q#567
rabilrbl merged 1 commit into
JioTV-Go:developfrom
Arshit-Singhal-Official:bugfix/m3u-tvgid-channelid-mismatch

Conversation

@Arshit-Singhal-Official

Copy link
Copy Markdown
Contributor

Summary

Replaces %s with %q when formatting tvg-id in M3U output to ensure the attribute is properly quoted.

What was the issue

  • tvg-id=channel123 was rendered without quotes
  • Some IPTV players failed to match EPG data due to this

Fix

  • Changed string formatting from %s to %q to produce tvg-id="channel123"

Testing

  • Ran the server and generated playlist.m3u
  • Verified correct tvg-id="..." format
  • Confirmed proper EPG-channel linkage in IPTV player

IMG20250710231348

@Arshit-Singhal-Official Arshit-Singhal-Official marked this pull request as ready for review July 10, 2025 18:08
@rabilrbl rabilrbl requested a review from Copilot July 15, 2025 02:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that the tvg-id attribute in generated M3U entries is properly wrapped in quotes by switching from %s to %q in the formatting string.

  • Updated fmt.Sprintf call to use %q for tvg-id in ChannelsHandler.
  • Manually tested playlist output and confirmed the quoted tvg-id enables correct EPG linking.
Comments suppressed due to low confidence (2)

internal/handlers/handlers.go:416

  • Consider adding a unit test for ChannelsHandler to assert that the generated M3U output includes tvg-id wrapped in quotes, ensuring this formatting change remains covered in future modifications.
			m3uContent += fmt.Sprintf("#EXTINF:-1 tvg-id=%q tvg-name=%q tvg-logo=%q tvg-language=%q tvg-type=%q group-title=%q, %s\n%s\n",

internal/handlers/handlers.go:416

  • [nitpick] Using string concatenation (+=) in a loop can lead to multiple memory reallocations; consider switching to a strings.Builder or bytes.Buffer to build m3uContent more efficiently.
			m3uContent += fmt.Sprintf("#EXTINF:-1 tvg-id=%q tvg-name=%q tvg-logo=%q tvg-language=%q tvg-type=%q group-title=%q, %s\n%s\n",

@rabilrbl

Copy link
Copy Markdown
Collaborator

Thanks @Arshit-Singhal-Official

@rabilrbl rabilrbl merged commit e926a95 into JioTV-Go:develop Jul 15, 2025
8 checks passed
@rabilrbl rabilrbl linked an issue Jul 15, 2025 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: tvg-id not quoted properly in M3U playlist

3 participants