Media request cache should be cleared when switching profile
- Dominant language
- Rust
- Stars
- 30.5k
- Forks
- 3.2k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 72
Description
I was playing with static media files in two profiles and noticed a case where caching is undesirable, namely, if we have a media file with the same name as a different file in a second profile but with different contents.
This appears to fix it but unfortunately re-introduces the issue fixed by https://github.com/ankitects/anki/commit/db5117ce1ab3b1393419d4fcc9c03678094f2f30
```diff
diff --git a/qt/aqt/main.py b/qt/aqt/main.py
index b28867ede..23a74fae8 100644
--- a/qt/aqt/main.py
+++ b/qt/aqt/main.py
@@ -373,6 +373,9 @@ class AnkiQt(QMainWindow):
callback()
self.profileDiag.hide()
+
+ self.web._page.profile().clearHttpCache()
+
# code flow is confusing here - if load fails, profile dialog
# will be shown again
self.loadProfile(on_done)
```
Probably not a big deal. I don't remember seeing any reports of it.
Contributor guide
Research direction
Read qt/aqt/main.py around the profile-switching flow, especially profileDiag.hide(), loadProfile(), and self.web._page.profile().clearHttpCache(). Review commit db5117ce1ab3b1393419d4fcc9c03678094f2f30 to understand the regression, then determine a profile-switch behavior that avoids stale same-name media without reintroducing it; done means both cases work correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100