Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bram Hagens
api
Commits
c4cc52a7
Commit
c4cc52a7
authored
6 years ago
by
Dean
Browse files
Options
Downloads
Patches
Plain Diff
version 1.6.3: fix swapped temp and storage directories
parent
818f6ac8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/routes/uploadpomf.go
+10
-2
10 additions, 2 deletions
lib/routes/uploadpomf.go
main.go
+1
-1
1 addition, 1 deletion
main.go
with
11 additions
and
3 deletions
lib/routes/uploadpomf.go
+
10
−
2
View file @
c4cc52a7
...
...
@@ -155,7 +155,7 @@ func UploadPomf(associateObjectsWithUser bool) func(http.ResponseWriter, *http.R
// Write file to MD5 and to temp file
hash
:=
md5
.
New
()
tempPath
:=
filepath
.
Join
(
viper
.
GetString
(
"pomf.
storage
Location"
),
key
+
ext
)
tempPath
:=
filepath
.
Join
(
viper
.
GetString
(
"pomf.
temp
Location"
),
key
+
ext
)
tempFile
,
err
:=
os
.
Create
(
tempPath
)
if
err
!=
nil
{
log
.
Error
()
.
Err
(
err
)
.
Msg
(
"failed to create destination file"
)
...
...
@@ -192,8 +192,16 @@ func UploadPomf(associateObjectsWithUser bool) func(http.ResponseWriter, *http.R
}
// Move file to the destination
destPath
:=
filepath
.
Join
(
viper
.
GetString
(
"pomf.
temp
Location"
),
key
+
ext
)
destPath
:=
filepath
.
Join
(
viper
.
GetString
(
"pomf.
storage
Location"
),
key
+
ext
)
err
=
os
.
Rename
(
tempPath
,
destPath
)
if
err
!=
nil
{
log
.
Error
()
.
Err
(
err
)
.
Msg
(
"failed to move file to the destination"
)
err
=
os
.
Remove
(
tempPath
)
if
err
!=
nil
{
log
.
Error
()
.
Err
(
err
)
.
Msg
(
"failed to delete temporary file after error"
)
}
panic
(
apierrors
.
InternalServerError
)
}
// Get MD5 hash digest
md5Hash
:=
hex
.
EncodeToString
(
hash
.
Sum
(
nil
))
...
...
This diff is collapsed.
Click to expand it.
main.go
+
1
−
1
View file @
c4cc52a7
...
...
@@ -26,7 +26,7 @@ import (
const
(
configLocationUnix
=
"/etc/whats-this/api/config.toml"
shutdownTimeout
=
10
*
time
.
Second
version
=
"1.6.
1
"
version
=
"1.6.
3
"
)
// printConfiguration iterates through a configuration map[string]interface{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment