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
c6e6c8ee
Commit
c6e6c8ee
authored
Nov 17, 2023
by
Michael Yang
Browse files
fix cross device rename
parent
a185b297
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
server/routes.go
server/routes.go
+7
-7
No files found.
server/routes.go
View file @
c6e6c8ee
...
...
@@ -666,8 +666,14 @@ func HeadBlobHandler(c *gin.Context) {
}
func
CreateBlobHandler
(
c
*
gin
.
Context
)
{
targetPath
,
err
:=
GetBlobsPath
(
c
.
Param
(
"digest"
))
if
err
!=
nil
{
c
.
AbortWithStatusJSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
return
}
hash
:=
sha256
.
New
()
temp
,
err
:=
os
.
CreateTemp
(
""
,
c
.
Param
(
"digest"
))
temp
,
err
:=
os
.
CreateTemp
(
filepath
.
Dir
(
targetPath
)
,
c
.
Param
(
"digest"
))
if
err
!=
nil
{
c
.
AbortWithStatusJSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
return
...
...
@@ -690,12 +696,6 @@ func CreateBlobHandler(c *gin.Context) {
return
}
targetPath
,
err
:=
GetBlobsPath
(
c
.
Param
(
"digest"
))
if
err
!=
nil
{
c
.
AbortWithStatusJSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
return
}
if
err
:=
os
.
Rename
(
temp
.
Name
(),
targetPath
);
err
!=
nil
{
c
.
AbortWithStatusJSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
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