Topic_link table contains wrong urls when using s3

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:

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?

3 Likes

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

Can I help you somehow?