Skip to content

Commit 652549b

Browse files
committed
fix: use quotated string to replace index name
1 parent cb4069d commit 652549b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

plugins/elasticsearch/middleware.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ func intercept(h http.HandlerFunc) http.HandlerFunc {
229229
for _, index := range indices {
230230
alias := classify.GetIndexAlias(index)
231231
if alias != "" {
232-
body = bytes.Replace(body, []byte(index), []byte(alias), -1)
232+
body = bytes.Replace(body, []byte(`"`+index+`"`), []byte(`"`+alias+`"`), -1)
233233
continue
234234
}
235235
// if alias is present in url get index name from cache
236236
indexName := classify.GetAliasIndex(index)
237237
if indexName != "" {
238-
body = bytes.Replace(body, []byte(indexName), []byte(index), -1)
238+
body = bytes.Replace(body, []byte(`"`+indexName+`"`), []byte(`"`+index+`"`), -1)
239239
}
240240
}
241241
util.WriteBackRaw(w, body, http.StatusOK)

0 commit comments

Comments
 (0)