Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-workhorse
Commits
5ae1356e
Commit
5ae1356e
authored
Jan 18, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use proper quotes escaping for DownloadArtifact method
Uses escaper from mime/multipart/writer.go.
parent
e0a2ea65
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
internal/artifacts/artifact_download.go
internal/artifacts/artifact_download.go
+3
-1
internal/artifacts/escape_quotes.go
internal/artifacts/escape_quotes.go
+10
-0
No files found.
internal/artifacts/artifact_download.go
View file @
5ae1356e
...
...
@@ -58,10 +58,12 @@ func unpackFileFromZip(archiveFileName, fileName string, headers http.Header, ou
}
defer
reader
.
Close
()
basename
:=
filepath
.
Base
(
fileName
)
// Write http headers about the file
headers
.
Set
(
"Content-Length"
,
strconv
.
FormatInt
(
int64
(
file
.
UncompressedSize64
),
10
))
headers
.
Set
(
"Content-Type"
,
detectFileContentType
(
file
.
Name
))
headers
.
Set
(
"Content-Disposition"
,
"attachment; filename=
\"
"
+
filepath
.
Base
(
file
.
N
ame
)
+
"
\"
"
)
headers
.
Set
(
"Content-Disposition"
,
"attachment; filename=
\"
"
+
escapeQuotes
(
basen
ame
)
+
"
\"
"
)
// Copy file body to client
_
,
err
=
io
.
Copy
(
output
,
reader
)
...
...
internal/artifacts/escape_quotes.go
0 → 100644
View file @
5ae1356e
package
artifacts
import
"strings"
// taken from mime/multipart/writer.go
var
quoteEscaper
=
strings
.
NewReplacer
(
"
\\
"
,
"
\\\\
"
,
`"`
,
"
\\\"
"
)
func
escapeQuotes
(
s
string
)
string
{
return
quoteEscaper
.
Replace
(
s
)
}
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