Browse Source

Merge pull request #1475 from donbowman/master

Fix race condition on ssh key delete, and revert re-revert of hard line break
pull/1490/head
无闻 9 years ago
parent
commit
ce8864c69a
  1. 6
      models/publickey.go
  2. 1
      modules/base/markdown.go

6
models/publickey.go

@ -386,9 +386,6 @@ func ListPublicKeys(uid int64) ([]*PublicKey, error) {
// rewriteAuthorizedKeys finds and deletes corresponding line in authorized_keys file. // rewriteAuthorizedKeys finds and deletes corresponding line in authorized_keys file.
func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error { func rewriteAuthorizedKeys(key *PublicKey, p, tmpP string) error {
sshOpLocker.Lock()
defer sshOpLocker.Unlock()
fr, err := os.Open(p) fr, err := os.Open(p)
if err != nil { if err != nil {
return err return err
@ -444,6 +441,9 @@ func UpdatePublicKey(key *PublicKey) error {
} }
func deletePublicKey(e *xorm.Session, key *PublicKey) error { func deletePublicKey(e *xorm.Session, key *PublicKey) error {
sshOpLocker.Lock()
defer sshOpLocker.Unlock()
has, err := e.Get(key) has, err := e.Get(key)
if err != nil { if err != nil {
return err return err

1
modules/base/markdown.go

@ -198,7 +198,6 @@ func RenderRawMarkdown(body []byte, urlPrefix string) []byte {
extensions |= blackfriday.EXTENSION_FENCED_CODE extensions |= blackfriday.EXTENSION_FENCED_CODE
extensions |= blackfriday.EXTENSION_AUTOLINK extensions |= blackfriday.EXTENSION_AUTOLINK
extensions |= blackfriday.EXTENSION_STRIKETHROUGH extensions |= blackfriday.EXTENSION_STRIKETHROUGH
extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK
extensions |= blackfriday.EXTENSION_SPACE_HEADERS extensions |= blackfriday.EXTENSION_SPACE_HEADERS
extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK

Loading…
Cancel
Save