Skip to content

Commit 5fffa70

Browse files
authored
fix: Fix the compatibility issue in URL.parse function (higress-group#537)
1 parent f9f3300 commit 5fffa70

File tree

1 file changed

+4
-2
lines changed
  • frontend/src/pages/ai/components/ProviderForm

1 file changed

+4
-2
lines changed

frontend/src/pages/ai/components/ProviderForm/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,10 @@ const ProviderForm: React.FC = forwardRef((props: { value: any }, ref) => {
323323
if (!item) {
324324
continue;
325325
}
326-
const url = URL.parse(item);
327-
if (!url) {
326+
let url;
327+
try {
328+
url = new URL(item);
329+
} catch (e) {
328330
return Promise.reject(t('llmProvider.providerForm.rules.invalidOpenaiCustomUrl') + item)
329331
}
330332
if (value.length > 1

0 commit comments

Comments
 (0)