Separated URL protocol matching and empty URL detection for clarity. Combined pattern for magnet into other protocol pattern. Fixed "if" issue ( !url && ( magnet_match || !other_match ) ) should not have been !other_match, but other_match.