Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
6538e867
Commit
6538e867
authored
Apr 25, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webdav: add tests + path.join for public url param
Fixes #7914. Fixes #7921
parent
6d9e8bd1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
7 deletions
+18
-7
docs/sources/installation/configuration.md
+1
-1
pkg/components/imguploader/s3uploader_test.go
+1
-1
pkg/components/imguploader/webdavuploader.go
+5
-3
pkg/components/imguploader/webdavuploader_test.go
+11
-2
No files found.
docs/sources/installation/configuration.md
View file @
6538e867
...
...
@@ -645,7 +645,7 @@ Secret key. e.g. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Url to where Grafana will send PUT request with images
### public_url
Url to send to users in notifications, directly appended with the resulting uploaded file name
Optional parameter. Url to send to users in notifications, directly appended with the resulting uploaded file name.
### username
basic auth username
...
...
pkg/components/imguploader/s3uploader_test.go
View file @
6538e867
...
...
@@ -8,7 +8,7 @@ import (
)
func
TestUploadToS3
(
t
*
testing
.
T
)
{
SkipConvey
(
"[Integration test] for external_image_store.
webdav
"
,
t
,
func
()
{
SkipConvey
(
"[Integration test] for external_image_store.
s3
"
,
t
,
func
()
{
setting
.
NewConfigContext
(
&
setting
.
CommandLineArgs
{
HomePath
:
"../../../"
,
})
...
...
pkg/components/imguploader/webdavuploader.go
View file @
6538e867
...
...
@@ -56,10 +56,12 @@ func (u *WebdavUploader) Upload(pa string) (string, error) {
}
if
u
.
public_url
!=
""
{
return
(
u
.
public_url
+
filename
),
nil
}
else
{
return
url
.
String
(),
nil
publicURL
,
_
:=
url
.
Parse
(
u
.
public_url
)
publicURL
.
Path
=
path
.
Join
(
publicURL
.
Path
,
filename
)
return
publicURL
.
String
(),
nil
}
return
url
.
String
(),
nil
}
func
NewWebdavImageUploader
(
url
,
username
,
password
,
public_url
string
)
(
*
WebdavUploader
,
error
)
{
...
...
pkg/components/imguploader/webdavuploader_test.go
View file @
6538e867
...
...
@@ -7,12 +7,21 @@ import (
)
func
TestUploadToWebdav
(
t
*
testing
.
T
)
{
webdavUploader
,
_
:=
NewWebdavImageUploader
(
"http://localhost:9998/dav/"
,
"username"
,
"password"
,
""
)
// Can be tested with this docker container: https://hub.docker.com/r/morrisjobke/webdav/
SkipConvey
(
"[Integration test] for external_image_store.webdav"
,
t
,
func
()
{
webdavUploader
,
_
:=
NewWebdavImageUploader
(
"http://localhost:8888/webdav/"
,
"test"
,
"test"
,
""
)
path
,
err
:=
webdavUploader
.
Upload
(
"../../../public/img/logo_transparent_400x.png"
)
So
(
err
,
ShouldBeNil
)
So
(
path
,
ShouldNotEqual
,
""
)
So
(
path
,
ShouldStartWith
,
"http://localhost:8888/webdav/"
)
})
SkipConvey
(
"[Integration test] for external_image_store.webdav with public url"
,
t
,
func
()
{
webdavUploader
,
_
:=
NewWebdavImageUploader
(
"http://localhost:8888/webdav/"
,
"test"
,
"test"
,
"http://publicurl:8888/webdav"
)
path
,
err
:=
webdavUploader
.
Upload
(
"../../../public/img/logo_transparent_400x.png"
)
So
(
err
,
ShouldBeNil
)
So
(
path
,
ShouldStartWith
,
"http://publicurl:8888/webdav/"
)
})
}
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