FileNameString returns the schema blob's base filename. If the fileName field of the blob accidentally or maliciously contains a slash, this function returns an empty string instead.
()
| 430 | // If the fileName field of the blob accidentally or maliciously |
| 431 | // contains a slash, this function returns an empty string instead. |
| 432 | func (ss *superset) FileNameString() string { |
| 433 | v := ss.FileName |
| 434 | if v == "" { |
| 435 | v = stringFromMixedArray(ss.FileNameBytes) |
| 436 | } |
| 437 | if v != "" { |
| 438 | if strings.Contains(v, "/") { |
| 439 | // Bogus schema blob; ignore. |
| 440 | return "" |
| 441 | } |
| 442 | if strings.Contains(v, "\\") { |
| 443 | // Bogus schema blob; ignore. |
| 444 | return "" |
| 445 | } |
| 446 | } |
| 447 | return v |
| 448 | } |
| 449 | |
| 450 | func (ss *superset) HasFilename(name string) bool { |
| 451 | return ss.FileNameString() == name |
no test coverage detected