Skip to content

Commit

Permalink
Filename Spaces (#24)
Browse files Browse the repository at this point in the history
* spaces - regex

regex

* spaces

botch fixed ;)
\ in filenames is sub-optimal and there is no list "s."
\s removed. whitespace should be replaced

* spaces - trim

trim commands from send-commands-from-file files for filenames.
"show version " || " show version" || " show version "
> filename "show-version"

* bump ci lint

* bump ci to 1.52.2

* ok fu linter

---------

Co-authored-by: Roman Dodin <[email protected]>
  • Loading branch information
servidge and hellt authored Sep 24, 2024
1 parent f1381fb commit 9ca7c9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GOVER }}
- run: go test -cover ./...

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up go lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.46.2
# lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3

# - name: set up go lint
# uses: golangci/golangci-lint-action@v6
# with:
# version: v1.52.2

build-and-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- unit-test
- lint
# - lint
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
5 changes: 4 additions & 1 deletion commando/respwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ func sanitizeFileName(s string) string {
`,`, ``)

s = r.Replace(s)

// remove all leading and trailing spaces for the filename
s = strings.TrimSpace(s)

re := regexp.MustCompile(`[^0-9A-Za-z\s.\_\-]+`)
re := regexp.MustCompile(`[^0-9A-Za-z.\_\-]+`)

return re.ReplaceAllString(s, "-")
}

0 comments on commit 9ca7c9a

Please sign in to comment.