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
7545755b
Commit
7545755b
authored
Sep 11, 2015
by
Abiola Ibrahim
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #240 from LK4D4/fix_map_race
markdown: fix race in accessing map
parents
26dc212f
a5128da6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
middleware/markdown/markdown.go
middleware/markdown/markdown.go
+4
-1
middleware/markdown/process.go
middleware/markdown/process.go
+2
-0
No files found.
middleware/markdown/markdown.go
View file @
7545755b
...
@@ -126,8 +126,11 @@ func (md Markdown) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error
...
@@ -126,8 +126,11 @@ func (md Markdown) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error
}
}
}
}
cfg
.
RLock
()
filepath
,
ok
:=
cfg
.
StaticFiles
[
fpath
]
cfg
.
RUnlock
()
// if static site is generated, attempt to use it
// if static site is generated, attempt to use it
if
filepath
,
ok
:=
cfg
.
StaticFiles
[
fpath
];
ok
{
if
ok
{
if
fs1
,
err
:=
os
.
Stat
(
filepath
);
err
==
nil
{
if
fs1
,
err
:=
os
.
Stat
(
filepath
);
err
==
nil
{
// if markdown has not been modified since static page
// if markdown has not been modified since static page
// generation, serve the static page
// generation, serve the static page
...
...
middleware/markdown/process.go
View file @
7545755b
...
@@ -153,7 +153,9 @@ func (md Markdown) generatePage(c *Config, requestPath string, content []byte) e
...
@@ -153,7 +153,9 @@ func (md Markdown) generatePage(c *Config, requestPath string, content []byte) e
return
err
return
err
}
}
c
.
Lock
()
c
.
StaticFiles
[
requestPath
]
=
filePath
c
.
StaticFiles
[
requestPath
]
=
filePath
c
.
Unlock
()
}
}
return
nil
return
nil
...
...
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