Closed ikreymer closed 8 years ago
This is not necessarily due to an invalid TimeMap, rather it's because of a case that was not taken care of. The panic is raised due to the following lines of the code:
kv := regs["kvaldlm"].Split(attr, 2)
linkmap[kv[0]] = kv[1]
In the above lines, a link attribute is split in name and value (0 and 1 indexes of an array respectively), then the value is added to a dictionary with the name as the key. It is possible that there is an attribute that does not have a value. This style of attributes is common in HTML attributes such as async
, readonly
, selected
, and disabled
etc. In such a case, existing code will have nothing for the value of kv[1]
which will cause this panic. Here is a test case that illustrates this issue.
However, the fix is simple. We just need to check if the kv
slice has at least two elements before assigning it, otherwise ignore the attribute.
Presumably this is caused by an invalid timemap, causes the response to 502