Browse Source

Only change update index if image actually changed.

pull/15/head
Joachim Bauch 12 years ago
parent
commit
faa32918fa
  1. 3
      src/app/spreed-speakfreely-server/images.go

3
src/app/spreed-speakfreely-server/images.go

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
package main
import (
"bytes"
"crypto/rand"
"encoding/base64"
"log"
@ -96,9 +97,11 @@ func (self *imageCache) Update(userId string, image string) string { @@ -96,9 +97,11 @@ func (self *imageCache) Update(userId string, image string) string {
img = self.images[result]
self.mutex.RUnlock()
}
if mimetype != img.mimetype || !bytes.Equal(img.data, decoded) {
img.updateIdx++
img.mimetype = mimetype
img.data = decoded
}
result += "/" + strconv.Itoa(img.updateIdx)
filename, ok := imageFilenames[mimetype]
if ok {

Loading…
Cancel
Save