{"record":{"id":"6eff2b66467eced4","repo":"LykosAI/StabilityMatrix","slug":"invalid-url-format","errorCode":null,"errorMessage":"Invalid URL format","messagePattern":"Invalid URL format","errorType":"validation","errorClass":"DataValidationException","httpStatus":null,"severity":"warning","filePath":"StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageExtensionBrowserViewModel.cs","lineNumber":705,"sourceCode":"        foreach (var item in InstalledItemsSearchCollection.FilteredItems)\n        {\n            item.IsSelected = true;\n        }\n    }\n\n    [RelayCommand]\n    private async Task InstallExtensionManualAsync()\n    {\n        var textField = new TextBoxField\n        {\n            Label = \"Extension URL\",\n            Validator = text =>\n            {\n                if (string.IsNullOrWhiteSpace(text))\n                    throw new DataValidationException(\"URL is required\");\n\n                if (!Uri.TryCreate(text, UriKind.Absolute, out _))\n                    throw new DataValidationException(\"Invalid URL format\");\n            },\n        };\n        var dialog = DialogHelper.CreateTextEntryDialog(\"Manual Extension Install\", \"\", [textField]);\n\n        if (await dialog.ShowAsync() != ContentDialogResult.Primary)\n            return;\n\n        var url = textField.Text.Trim();\n        if (string.IsNullOrWhiteSpace(url))\n            return;\n\n        if (\n            !Uri.TryCreate(url, UriKind.Absolute, out var uri)\n            || !uri.Host.Equals(\"github.com\", StringComparison.OrdinalIgnoreCase)\n        )\n        {\n            notificationService.Show(\"Invalid URL\", \"Please provide a valid GitHub repository URL.\");\n            return;","sourceCodeStart":687,"sourceCodeEnd":723,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageExtensionBrowserViewModel.cs#L687-L723","documentation":"In InstallExtensionManualAsync, after the non-empty check, the validator attempts Uri.TryCreate with UriKind.Absolute; if parsing fails it throws DataValidationException('Invalid URL format'). It ensures only well-formed absolute URLs are accepted for manual extension installation.","triggerScenarios":"Submitting text in the Manual Extension Install dialog that is non-empty but not a parseable absolute URI, e.g. 'github.com/foo/bar' (no scheme), 'htp://bad', or a bare git SSH string like 'git@github.com:foo/bar'.","commonSituations":"Omitting the https:// scheme when pasting a repo URL; pasting an SCP-style git remote; trailing typos from manual typing.","solutions":["Include a valid scheme, e.g. 'https://github.com/user/repo'.","Avoid SCP-style remotes (git@host:path); convert them to https URLs.","Validate the URL in a browser or with Uri.TryCreate before submitting."],"exampleFix":"// before\nif (!Uri.TryCreate(text, UriKind.Absolute, out _)) throw new DataValidationException(\"Invalid URL format\");\n// after\nif (!Uri.TryCreate(text?.Trim(), UriKind.Absolute, out var uri)\n    || uri.Scheme is not (\"http\" or \"https\" or \"git\"))\n    throw new DataValidationException(\"Invalid URL format\");","handlingStrategy":"validation","validationCode":"bool IsValidAbsoluteUrl(string? s) =>\n    Uri.TryCreate(s?.Trim(), UriKind.Absolute, out var u) && u.Scheme is \"http\" or \"https\" or \"git\";","typeGuard":"bool TryGetUrl(string? s, out Uri uri) => Uri.TryCreate(s?.Trim(), UriKind.Absolute, out uri!) && uri.Scheme != \"unknown\";","tryCatchPattern":"try { await InstallExtensionManualAsync(); }\ncatch (DataValidationException ex) { ShowWarning(ex.Message); }","preventionTips":["Copy URLs directly from the browser address bar so the scheme is included.","Convert SCP-style git remotes (git@host:path) to https:// form first.","Pre-validate with Uri.TryCreate before opening the dialog."],"tags":["validation","url","input"],"backgroundTag":"invalid-url-format","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}