johnste / finicky

A macOS app for customizing which browser to start
MIT License
3.62k stars 133 forks source link

ServiceNow link crashes finicky.log() #328

Open nemws1 opened 2 months ago

nemws1 commented 2 months ago

Describe the bug Finicky dies/crashes/immediately exits with a ServiceNow link with logging turned on

Your configuration

// Use https://finicky-kickstart.now.sh to generate basic configuration
// Learn more about configuration options:
// https://github.com/johnste/finicky/wiki/Configuration
// https://github.com/johnste/finicky/wiki/Troubleshooting-&-Tips

module.exports = {
    defaultBrowser: "Firefox",

    rewrite: [
        {
            match(all) {
                finicky.log(JSON.stringify(all, null, 2));
                return false;
            },
            url: ({ url }) => url,
        }
    ]
}

To Reproduce Steps to reproduce the behavior: I received this link (in Teams, but Finicky crashes no matter how I try to open it):

https://borderstates.service-now.com/nav_to.do?uri=%2Fincident.do%3Fsys_id%3Dec58338d470e4650d3b39d75536d4314%26sysparm_record_target%3Dtask%26sysparm_record_row%3D7%26sysparm_record_rows%3D11%26sysparm_record_list%3Dassigned_to%3D821397091bab09103baa64e8bc4bcbbf%5EstateNOT%2BIN3,4,7,6%5Esys_class_name%3Dincident%5EORDERBYpriority%5EORDERBYnumber

Clicking on it in Teams or copying the URL and trying to "open" it from the terminal crashes Finicky.

If I comment out the "finicky.log" line in my .finicky.js file, then it works fine.

Here's one of the crash files I got: Finicky-2024-05-13-094003.ips.txt

sergei-dyshel commented 2 months ago

Happened for me too with other similar long URL. After some debugging and reading, it seems that % followed by some characters in URL is interpreted as format specifier by NSLog and crashes it. Proposed a fix in https://github.com/johnste/finicky/pull/329.

sergei-dyshel commented 2 months ago

Until pull request is merged, if you don't want to build by yourself, you can use Finicky.zip that I've built locally that includes that patch.

nemws1 commented 2 months ago

Thanks for the build - works perfectly now! :)