fix: link the exact stream in discussion:validate fulfilled comments

The fulfilled comment looked for the first line containing the stream ID
as a substring, so a request for MTV.fr@SD linked the line of
BFMTV.fr@SD. Match the quoted tvg-id attribute instead.
This commit is contained in:
leoca committed 2026-11-03 21:30:22 +00:00
1 parent 726b042085
commit e7f405b8a8
3 files changed
+6 -2

No files matched your search

+1 -1
View File
@@ -86,7 +86,7 @@ async function main() {
for (const filePath of files) { for (const filePath of files) {
const content = await streamsStorage.load(filePath) const content = await streamsStorage.load(filePath)
const lines = content.split(/\r?\n/) const lines = content.split(/\r?\n/)
const lineIndex = lines.findIndex(line => line.includes(streamId)) const lineIndex = lines.findIndex(line => line.includes(`tvg-id="${streamId}"`))
if (lineIndex !== -1) { if (lineIndex !== -1) {
const permalink = `https://github.com/${repo}/blob/${sha}/streams/${filePath}#L${lineIndex + 1}-L${lineIndex + 2}` const permalink = `https://github.com/${repo}/blob/${sha}/streams/${filePath}#L${lineIndex + 1}-L${lineIndex + 2}`
comment = `A link to the "${streamId}" stream is already in the playlist: ${permalink}` comment = `A link to the "${streamId}" stream is already in the playlist: ${permalink}`
@@ -1,3 +1,5 @@
#EXTM3U #EXTM3U
#EXTINF:-1 tvg-id="NewCNBCe.tr@SD",New CNBCe
https://example.com/newcnbce.m3u8
#EXTINF:-1 tvg-id="CNBCe.tr@SD",CNBCe #EXTINF:-1 tvg-id="CNBCe.tr@SD",CNBCe
https://ythls.onrender.com/channel/UC40TUSUx490U5uR1lZt3Ajg.m3u8 https://ythls.onrender.com/channel/UC40TUSUx490U5uR1lZt3Ajg.m3u8
+3 -1
View File
@@ -28,7 +28,9 @@ describe('discussion:validate', () => {
const result = readResultJson() const result = readResultJson()
expect(result.status).toBe('fulfilled') expect(result.status).toBe('fulfilled')
expect(result.label).toBe('check:failed') expect(result.label).toBe('check:failed')
expect(result.comment).toContain('https://github.com/test-owner/test-repo/blob/main/') expect(result.comment).toContain(
'https://github.com/test-owner/test-repo/blob/main/streams/br.m3u#L4-L5'
)
expect(result.close).toBe('true') expect(result.close).toBe('true')
}) })