picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.58k stars 325 forks source link

[Mac] Fix loading local resources on Webview #2436

Closed Miepee closed 1 year ago

Miepee commented 1 year ago

This just used the info from #2380, I don't currently have access to a Mac, so I didn't test this.

@somelinguist can you (or someone else) use the action-built test suite from here to see whether the fix correctly works?

Fixes #2380 (hopefully)

cwensley commented 1 year ago

Hey @Miepee, thanks for the fix! This is great, however I think you are missing a null check on baseUri before using it, which is its default value.

Miepee commented 1 year ago

As far as I can see, the ToNS() extension method already includes the null check.

        public static NSUrl ToNS(this Uri uri)
        {
            return uri == null ? null : new NSUrl(uri.AbsoluteUri);
        }
cwensley commented 1 year ago

While that is true, the WKWebView.LoadFileUrl() call does not allow null for either of its parameters, so it will crash.