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
nexedi
caddy
Commits
38c24634
Commit
38c24634
authored
Jul 18, 2016
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ACME asset migration when renaming folders
parent
df018ea6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
caddy/caddymain/run.go
caddy/caddymain/run.go
+18
-11
No files found.
caddy/caddymain/run.go
View file @
38c24634
...
...
@@ -188,18 +188,25 @@ func moveStorage() {
log
.
Fatalf
(
"[ERROR] Unable to migrate certificate storage: %v
\n\n
Please follow instructions at:
\n
https://github.com/mholt/caddy/issues/902#issuecomment-228876011"
,
err
)
}
// convert mixed case folder and file names to lowercase
filepath
.
Walk
(
string
(
newPath
),
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
// must be careful to only lowercase the base of the path, not the whole thing!!
base
:=
filepath
.
Base
(
path
)
if
lowerBase
:=
strings
.
ToLower
(
base
);
base
!=
lowerBase
{
lowerPath
:=
filepath
.
Join
(
filepath
.
Dir
(
path
),
lowerBase
)
err
=
os
.
Rename
(
path
,
lowerPath
)
if
err
!=
nil
{
log
.
Fatalf
(
"[ERROR] Unable to lower-case: %v
\n\n
Please follow instructions at:
\n
https://github.com/mholt/caddy/issues/902#issuecomment-228876011"
,
err
)
var
done
bool
// walking is recursive and preloads the file names, so we must restart walk after a change until no changes
for
!
done
{
done
=
true
filepath
.
Walk
(
string
(
newPath
),
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
// must be careful to only lowercase the base of the path, not the whole thing!!
base
:=
filepath
.
Base
(
path
)
if
lowerBase
:=
strings
.
ToLower
(
base
);
base
!=
lowerBase
{
lowerPath
:=
filepath
.
Join
(
filepath
.
Dir
(
path
),
lowerBase
)
err
=
os
.
Rename
(
path
,
lowerPath
)
if
err
!=
nil
{
log
.
Fatalf
(
"[ERROR] Unable to lower-case: %v
\n\n
Please follow instructions at:
\n
https://github.com/mholt/caddy/issues/902#issuecomment-228876011"
,
err
)
}
// terminate traversal and restart since Walk needs the updated file list with new file names
done
=
false
return
errors
.
New
(
"start over"
)
}
}
return
nil
}
)
return
nil
})
}
}
// setVersion figures out the version information
...
...
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