Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
45b6a12e
Commit
45b6a12e
authored
May 01, 2024
by
Michael Yang
Browse files
server: target invalid
parent
a3e60d90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
cmd/cmd.go
cmd/cmd.go
+1
-1
server/routes.go
server/routes.go
+3
-6
No files found.
cmd/cmd.go
View file @
45b6a12e
...
@@ -1125,7 +1125,7 @@ Environment Variables:
...
@@ -1125,7 +1125,7 @@ Environment Variables:
RunE
:
ListHandler
,
RunE
:
ListHandler
,
}
}
copyCmd
:=
&
cobra
.
Command
{
copyCmd
:=
&
cobra
.
Command
{
Use
:
"cp SOURCE
TARGET
"
,
Use
:
"cp SOURCE
DESTINATION
"
,
Short
:
"Copy a model"
,
Short
:
"Copy a model"
,
Args
:
cobra
.
ExactArgs
(
2
),
Args
:
cobra
.
ExactArgs
(
2
),
PreRunE
:
checkServerHeartbeat
,
PreRunE
:
checkServerHeartbeat
,
...
...
server/routes.go
View file @
45b6a12e
...
@@ -810,16 +810,13 @@ func (s *Server) CopyModelHandler(c *gin.Context) {
...
@@ -810,16 +810,13 @@ func (s *Server) CopyModelHandler(c *gin.Context) {
src
:=
model
.
ParseName
(
r
.
Source
)
src
:=
model
.
ParseName
(
r
.
Source
)
if
!
src
.
IsValid
()
{
if
!
src
.
IsValid
()
{
_
=
c
.
Error
(
fmt
.
Errorf
(
"source %q is invalid"
,
r
.
Source
))
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
fmt
.
Sprintf
(
"source %q is invalid"
,
r
.
Source
)})
return
}
}
dst
:=
model
.
ParseName
(
r
.
Destination
)
dst
:=
model
.
ParseName
(
r
.
Destination
)
if
!
dst
.
IsValid
()
{
if
!
dst
.
IsValid
()
{
_
=
c
.
Error
(
fmt
.
Errorf
(
"destination %q is invalid"
,
r
.
Destination
))
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
fmt
.
Sprintf
(
"destination %q is invalid"
,
r
.
Source
)})
}
if
len
(
c
.
Errors
)
>
0
{
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
c
.
Errors
.
Errors
()})
return
return
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment