Topic_link table contains wrong urls when using s3

AI-generated summary

User caiiiyucuk is experiencing an issue with the topic_link table, where external link clicks are not being counted for URLs containing uploaded files hosted on S3 + CDN. They’ve noticed that links not being counted have the wrong URL pattern (https://cdn.dos.zone/<path-to-file>) instead of the correct pattern (https://dos.zone/rep/my/<url-to-file>). sam suspects that the CDN substitution might be happening after extraction and has asked vinothkannans to investigate. vinothkannans is currently unable to reproduce the issue but is looking into it.

Hi. I faced problem that external link clicks not counted for url that contains uploaded files hosted on s3 + cdn. Look this topic to understand the problem:

https://talks.dos.zone/t/collections/44653

Open a “Racing” category, you will see something like this:

Test Drive never account a click on it. It’s because topic_link table does not contains record of it. All the links on this page use the same pattern: https://dos.zone/rep/my/<encoded-url-to-file>

All links that works correctly are on files uploaded manually. But, links that not counted uploaded with discourse. E.g.:
https://doszone-uploads.s3.dualstack.eu-central-1.amazonaws.com/custom/dos/death-rally.jsdos - COUNTING,
https://doszone-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/2X/a/abcf902327ce1cf6fe7b3e8c809d638984377d7c.jsdos - NOT COUNTING.

I dumped the topic_link table for this topic topic_link.csv (6.9 КБ)

If you look in it, all not counting links stored as https://cdn.dos.zone/<path-to-file> instead of correct https://dos.zone/rep/my/<url-to-file>. Counting links are stored correctly.

I tried to find why this happens but no luck, topic_link.rb/extract_from do nothing with cdn :thinking:

1 Like

This seems like something we should clean up. Probably our CDN substitution happens after the extraction.

@vinothkannans can you investigate and see if you can repro here as well?

4 Likes

I’m unable to reproduce this issue yet. Anyway, it’s still in my list :memo:

1 Like

Can I help you somehow?

1 Like