aboutsummaryrefslogtreecommitdiffstats
path: root/common/registrar/registrar.go
diff options
context:
space:
mode:
Diffstat (limited to 'common/registrar/registrar.go')
-rw-r--r--common/registrar/registrar.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/common/registrar/registrar.go b/common/registrar/registrar.go
index 457dd6894..262231762 100644
--- a/common/registrar/registrar.go
+++ b/common/registrar/registrar.go
@@ -339,22 +339,15 @@ func (self *Registrar) HashToUrl(chash common.Hash) (uri string, err error) {
key := storageAddress(storageFixedArray(mapaddr, storageIdx2Addr(idx)))
hex := self.backend.StorageAt(UrlHintAddr[2:], key)
str = string(common.Hex2Bytes(hex[2:]))
- l := len(str)
- for (l > 0) && (str[l-1] == 0) {
- l--
+ l := 0
+ for (l < len(str)) && (str[l] == 0) {
+ l++
}
- str = str[:l]
+ str = str[l:]
uri = uri + str
idx++
}
-
- l := 0
- for (l < len(uri)) && (uri[l] == 0) {
- l++
- }
- uri = uri[l:]
-
if len(uri) == 0 {
err = fmt.Errorf("GetURLhint: URL hint not found for '%v'", chash.Hex())
}