* Sanitise host_whitelist and login/request IP addresses
* Keep json keys
* Remove all IPv4 and IPv6 from logs
* Less crazy remote label replacements
* Remove unused import
* Sanitise public ipv4/ipv6 and test
* Add loopback/link-local test cases
* Switch is_local_addr to is_lan_addr because the former allows user configuration of trusted addresses
* Remove prefix group, ip regex should be good enough
directory_is_writable_with_file() removed its fixed-name temp file in a
non-atomic exists/remove/open/remove sequence wrapped in a blanket
"except Exception: return False". If the test file was removed between the
write and the final os.remove (e.g. by a concurrent writability check), the
FileNotFoundError was swallowed and reported as "is not writable at all.
This blocks downloads." -- a false negative on a fully writable folder.
Make the result depend only on creating and writing the file; treat cleanup
as best-effort. Genuine write failures still return False, and the unicode
and special-character capability checks are unchanged.
Adds regression tests for the cleanup race and for a genuine write failure.
* Fix RuntimeError from dict mutation in stop_idle_jobs (#3431)
Collecting exhausted articles into a snapshot list while holding
nzf.lock, then calling register_article outside the iteration.
This prevents RuntimeError when register_article -> nzf.remove_article
pops from nzf.articles (a dict) while stop_idle_jobs is iterating it.
The original code in fd3ece31c used `nzf.articles[:]` which was safe
when articles was a list. When 44d94226e changed articles to a dict
the protective copy was dropped, leaving bare dict iteration that
mutates mid-loop.
The collect-then-act pattern matches nzf_remove_list in nzb/object.py
and the empty-nzo list already used in stop_idle_jobs itself. It also
correctly calls register_article outside nzf.lock, consistent with its
own "not locked for performance" contract.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Apply Black formatting to nzbqueue.py
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Soften comment per maintainer feedback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* Match to previous RSS behaviour
* Cleanup logic due to normalisation
* Tests comparing 4.5.5 outcome
* Remove comment - fixed since 4.5.5
* Consistent types for prio, rule, season, and episode
* Rename matching_rule_index
* Fix type warnings
* Extend Cleanup List with filename and path pattern matching
Previously limited to cleaning up files based only on their extensions, the 'Cleanup List' now supports more flexible matching. Users can specify:
- Exact filenames (e.g., `Thumbs.db`)
- Wildcard filename patterns (e.g., `*.tmp`, `cleanup.*`)
- Relative path patterns (e.g., `images/*`, `*/test.jpg`)
This enhancement provides greater control and flexibility for automated post-processing cleanup.
* Remove UI delays
* Everything using set_config, set_platform, or pyfakefs
* tmp_path
* Scroll to top seems unnecessary but make it wait until it's done
* Remove sleep from test_rss_basic_flow
* Remove sleeps from test_daemonizing
* Define pytest markers
* Reduce sleep in test_queue_repair
* Remove sleeps from clean_cache_dir
* Suppress failures to connect during startup
* Reduce cache sleeps
* Reduce sleeps checking app started
* Reduce sleep removing cache dir
Refactor RSS feed processing logic to enhance clarity and ensure correct precedence for resolved options. Renames functions and variables for better understanding, and inlines feed configuration logic. Adds new tests to verify how category, post-processing, script, and priority settings are applied hierarchically. Also provides a default display for empty RSS log categories.
* Replace duplicate nzo_ids in history database and use uuid4
* Remove SABnzbd_nzo on reuse
* Keep SABnzbd_nzo_ prefix for future jobs
* Try loading from multiple normal and future paths
* Purege NZO_FILE
* Rename NZO_FILE
* Allow failed migration to rollback
* Perform diskspace check on complete directory for nzo
* Always check complete_dir even if complete_free is 0
* Slots require 3.10
* Fix direct unpack calculation
* Schedule resume against download_dir, complete_dir, or an arbitrary path
* Document params
* Replace Diskspace with returning a tuple
* Fix the broken things
* Add diskspace tests
* Do not add sockets that are not already connected
* Don't preemptively mark thread busy
* Clear nntp instance on failed connect
* Just use reset_nw like everywhere else
* Track when the socket is connected and idle connections can handle requested when connected (completed auth) or socket_connected
* Add tests for connection state handling
* Windows is really slow at this
* Rename connected to ready and socket_connected to connected
* Implement direct write
* Support direct_write changes at runtime
* Check sparse support when download_dir changes
* Fixes to reverting to append mode and add tests
* Single write path, remove truncate, improve tests, add test for append mode with out of order direct writes
* assert expected nzf.assembler_next_index
* bytes_written_sequentially assertions
* Slim tests and mock load_article as a dictionary
* More robust bytes_written_sequentially
* Worked but guard Python -1 semantics
* os.path.getsize silly
* Add test with force followed by append to gaps
* Split flush_cache into its own function so the loop does not need to clear the article variable
* Fewer private functions
* Extract article cache limit for waiting constant
* Move option back to specials
* Use Status.DELETED for clarity
* Use nzo.lock in articlecache
* Document why assembler_next_index increments
* Remove duplicated code from write
* load_data formatting
* Create files with the same permissions as with open(...)
* Options are callable
* Fix crash if direct writing from cache but has been deleted
* Fix crash in next_index check via article cache
* Fix assembler waiting for register_article and cache waiting for assembler to write
* Simplify flush_cache loop and only log once per second
* Document why we would leave the assembler when forced at the first not tried article
* When skippedwe can't increment the next_index
* Rename bytes_written_sequentially to sequential_offset improve comments and logic
* Don't need to check when the config changes, due to the runtime changes any failure during assembly will disable it
* Remove unused constant
* Improve append triggering based on contiguous bytes ready to write to file and add a trigger to direct write
* Throttle downloader threads when direct writing out of order
* Clear ready_bytes when removed from queue
* Rework check_assembler_levels sleeping to have a deadline, be based on if the assembler actual pending bytes, and if delaying could have any impact
* Always write first articles if filenames are checked
* Rename force to allow_non_contiguous so it is clearer what it means
* Article is required
* Tweak delay triggers
* Fix for possible dictionary changed size during iteration
* postproc only gets the nzo
* Rename constants and remove redundant calculation
* For safety just key by nzf_id
* Not redundant because capped at 500M
* Tweak a little more
* Only delay if assembler is busy
* Remove unused constant and rename the remaining one
* Calculate if direct write is allowed when cache limit changes
* Allow direct writes to bypass trigger
* Avoid race to requeue
* Breakup the queuing logic so its understandable
* Pipelining and performance optimisations
* Refactor to remove handle_remainder and add on_response callback to allow inspecting of nntp messages
* Logic fix if there are sockets but nothing to read/write
* Fix logic errors for failed article requests
* Fix logic for reconfiguring servers
* Add guard_restart callback to pipelining_requests
* Fix article download stats
* Fix current article request shown via api
* Removal of DecodingStatus
* Fix circular reference
* Cleanup imports
* Handle reset_nw and hard_reset for inflight requests
* Improve __request_article behaviour using discard helper
* Article should be None here (before auth) but just in case
* Remove command_queue_condition unnecessary with the pull rather than push queue system
* During reset discard any data received prior to sending quit request
* Circular references again
* Revert to using bytearray
* Revert "During reset discard any data received prior to sending quit request"
This reverts commit ed522e3e80.
* Simpler interaction with sabctools
* Temporarily use the sabctools streaming decoder branch
* Fix most uu tests
* Reduce maximum pipelining requests
* Fix the squiggly line
* Remove some LOG_ALL debug code
* Make get_articles return consistent (None) - it now populates the server deque
* Reduce NNTP_BUFFER_SIZE
* Rename PIPELINING_REQUESTS to DEF_PIPELINING_REQUESTS
* A little refactoring
* Reduce default pipelining until it is dynamic
* Use BoundedSemaphore and fix the unacquired release
* Use crc from sabctools for uu and make filename logic consistent wit yenc
* Use sabctools 9.0.0
* Fix Check Before Download
* Move lock to NzbFile
* Use sabctools 9.1.0
* Minor change
* Fix 430 on check before download
* Update sabnews to work reliably with pipelining
* Minor tidy up
* Why does only Linux complain about this
* Leave this as it was
* Remove unused import
* Compare enum by identity
* Remove command_queue and just prepare a single request
Check if it should be sent and discard when paused
* Kick-start idle connections
* Modify events sockets are monitored for
* Update all dependencies
* Pin tavern due to failure in newer versions
* User SABnzbd User-agent in wiki test
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Safihre <safihre@sabnzbd.org>