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

Enclosure Deletion Bug #4

Closed
chrisspen opened this issue Jan 31, 2020 · 2 comments
Closed

Enclosure Deletion Bug #4

chrisspen opened this issue Jan 31, 2020 · 2 comments

Comments

@chrisspen
Copy link

Hi,

Just wanted to alert you to a massive bug I discovered. I've been maintaining my separate branch for a project I'm working on. I have a lot of custom models linked to the Enclosure model by foreign key. Then the other day, I noticed all my records linked to enclosures for a specific source suddenly vanished.

It took me a while, but I think I've tracked it down to the parse_feed_json() method. You have logic there to delete old enclosures if their URL doesn't exist in the current feed. That's usually not a problem. However, many RSS feeds wrap the true podcast URL with a prefix URL to track downloads, and occasionally these tracker URLs change. When that happens, that causes this code to delete all the enclosure records, and, in my case, everything attached to them.

My patch for this is to remove the calls to delete(), so I never risk wiping out my database when some podcast server switches up its tracking links. I've also disabled the logic to create an enclosure if the URL is new, since that allows logical duplicates where the same MP3 url has two different tracking links prepended to it. It seems safe to only create a new enclosure if none exist, since 99.99% of the time, a post only ever has one enclosure.

I'd submit a PR, but my codebase has diverged so much from yours, it would be a little unwieldy. I just want to give you a heads up, so this problem doesn't bite you too.

@xurble
Copy link
Owner

xurble commented Feb 5, 2020

Thanks for the heads up. I'll have a ponder.

@xurble
Copy link
Owner

xurble commented Feb 24, 2024

4 (Four!) years later. In the next release there will be a setting FEEDS_KEEP_OLD_ENCLOSURES which defaults to False.

@xurble xurble closed this as completed in 4559af5 Feb 24, 2024
xurble added a commit that referenced this issue Feb 24, 2024
…-if-source-url-changes)

Fixes #4.  Option to keep old enclosures when URL changes.
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

No branches or pull requests

2 participants