Logo
Explore Help
Register Sign In
zlei6/ragflow
1
0
Fork 0
You've already forked ragflow
mirror of https://github.com/infiniflow/ragflow.git synced 2026-07-05 19:08:38 +08:00
Code Issues Packages Projects Releases Wiki Activity
Files
e2b0da9eea5bfb33fbeaec002951ec8c701bb861
ragflow/internal/handler/providers_test.go

2 lines
16 B
Go
Raw Normal View History

fix: validate custom model inputs (#15200) ### What problem does this PR solve? Closes #15199. The add-custom-model endpoint is routed through `/api/v1/providers/:provider_name/instances/:instance_name/models`, but the handler previously trusted `provider_name` and `instance_name` from the JSON body instead of the path target. A request could therefore hit one provider/instance URL while operating on a different body provider/instance. The same handler only rejected `model_types` when the slice was nil. An empty array passed validation and reached `ModelProviderService.AddCustomModel`, where `request.ModelTypes[0]` could panic. This PR makes the path provider/instance authoritative, rejects mismatched body values, rejects missing or empty `model_types`, and adds a service-level guard so direct service callers cannot hit the same panic path. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
2026-05-28 23:15:01 -03:00
package handler
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.5 Page: 270ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API