Skip to content

Commit

Permalink
adding support for ufile (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzack9999 authored Mar 15, 2023
1 parent 4ca73e3 commit 3d18716
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/output/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var FieldNames = []string{
"qurl",
"qpath",
"file",
"ufile",
"key",
"value",
"kv",
Expand Down Expand Up @@ -160,6 +161,13 @@ func formatField(output *Result, fields string) []fieldOutput {
svalue = append(svalue, fieldOutput{field: "file", value: basePath})
}
}
case "ufile":
if parsed.Path != "" && parsed.Path != "/" {
basePath := path.Base(parsed.Path)
if strings.Contains(basePath, ".") {
svalue = append(svalue, fieldOutput{field: "ufile", value: parsed.String()})
}
}
case "udir":
if parsed.Path != "" && parsed.Path != "/" {
if strings.Contains(parsed.Path[1:], "/") {
Expand Down Expand Up @@ -199,6 +207,11 @@ func getValueForField(output *Result, parsed *url.URL, hostname, rdn, rurl, fiel
return rdn
case "rurl":
return rurl
case "ufile":
basePath := path.Base(parsed.Path)
if parsed.Path != "" && parsed.Path != "/" && strings.Contains(basePath, ".") {
return parsed.String()
}
case "file":
basePath := path.Base(parsed.Path)
if parsed.Path != "" && parsed.Path != "/" && strings.Contains(basePath, ".") {
Expand Down

0 comments on commit 3d18716

Please sign in to comment.