Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
6b8e40b3
Commit
6b8e40b3
authored
Jun 02, 2017
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
browse: Fix symlink indicators for files in folders other than cwd
Related to #1660 and #1667
parent
132f2a9c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
caddyhttp/browse/browse.go
caddyhttp/browse/browse.go
+9
-4
No files found.
caddyhttp/browse/browse.go
View file @
6b8e40b3
...
@@ -9,6 +9,7 @@ import (
...
@@ -9,6 +9,7 @@ import (
"net/url"
"net/url"
"os"
"os"
"path"
"path"
"path/filepath"
"sort"
"sort"
"strconv"
"strconv"
"strings"
"strings"
...
@@ -259,7 +260,7 @@ func directoryListing(files []os.FileInfo, canGoUp bool, urlPath string, config
...
@@ -259,7 +260,7 @@ func directoryListing(files []os.FileInfo, canGoUp bool, urlPath string, config
url
:=
url
.
URL
{
Path
:
"./"
+
name
}
// prepend with "./" to fix paths with ':' in the name
url
:=
url
.
URL
{
Path
:
"./"
+
name
}
// prepend with "./" to fix paths with ':' in the name
fileinfos
=
append
(
fileinfos
,
FileInfo
{
fileinfos
=
append
(
fileinfos
,
FileInfo
{
IsDir
:
f
.
IsDir
()
||
isSymlinkTargetDir
(
f
),
IsDir
:
f
.
IsDir
()
||
isSymlinkTargetDir
(
f
,
urlPath
,
config
),
IsSymlink
:
isSymlink
(
f
),
IsSymlink
:
isSymlink
(
f
),
Name
:
f
.
Name
(),
Name
:
f
.
Name
(),
Size
:
f
.
Size
(),
Size
:
f
.
Size
(),
...
@@ -286,15 +287,19 @@ func isSymlink(f os.FileInfo) bool {
...
@@ -286,15 +287,19 @@ func isSymlink(f os.FileInfo) bool {
// isSymlinkTargetDir return true if f's symbolic link target
// isSymlinkTargetDir return true if f's symbolic link target
// is a directory. Return false if not a symbolic link.
// is a directory. Return false if not a symbolic link.
func
isSymlinkTargetDir
(
f
os
.
FileInfo
)
bool
{
func
isSymlinkTargetDir
(
f
os
.
FileInfo
,
urlPath
string
,
config
*
Config
)
bool
{
if
!
isSymlink
(
f
)
{
if
!
isSymlink
(
f
)
{
return
false
return
false
}
}
target
,
err
:=
os
.
Readlink
(
f
.
Name
())
fullPath
:=
func
(
fileName
string
)
string
{
fullPath
:=
filepath
.
Join
(
string
(
config
.
Fs
.
Root
.
(
http
.
Dir
)),
urlPath
,
fileName
)
return
filepath
.
Clean
(
fullPath
)
}
target
,
err
:=
os
.
Readlink
(
fullPath
(
f
.
Name
()))
if
err
!=
nil
{
if
err
!=
nil
{
return
false
return
false
}
}
targetInfo
,
err
:=
os
.
Lstat
(
target
)
targetInfo
,
err
:=
os
.
Lstat
(
fullPath
(
target
)
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
return
false
}
}
...
...
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