Skip to content

Commit

Permalink
Fix file path parsing (#124)
Browse files Browse the repository at this point in the history
* Add failing test using ~ char

* fix regular expression adding ~

* prepare new release

* fix version
  • Loading branch information
YotillaAntoni authored Jan 13, 2025
1 parent 6dc81ea commit fd74632
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .project-keeper.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sources:
- type: golang
path: go.mod
version: 1.0.10
version: 1.0.11
excludes:
# Releases are done with Release Droid because PK does not yet support release process for Go projects.
- "E-PK-CORE-26: 'release_config.yml' exists but must not exist. Reason: Release-droid configuration is replaced by release.yml"
1 change: 1 addition & 0 deletions doc/changes/changelog.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions doc/changes/changes_1.0.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Exasol Driver go 1.0.11, released 2025-??-??

Code name: Fix import file name parsing

## Summary

This release fixes an issue parsing file names in IMPORT statements

## Bugfixes

* #123: Fixed parsing of file names in IMPORT statements
2 changes: 1 addition & 1 deletion internal/utils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func GetRowSeparator(query string) string {
const FILE_PLACEHOLDER = "FilePlaceholder"

var fileQueryRegex = regexp.MustCompile(`(?i)` + `FILE` + WHITESPACE +
QUOTE + namedGroup(FILE_PLACEHOLDER, `[a-zA-Z0-9:<> \\\/._-]+`) + QUOTE + ` ?`)
QUOTE + namedGroup(FILE_PLACEHOLDER, `[a-zA-Z0-9:<> \\/._\-~]+`) + QUOTE + ` ?`)

func GetFilePaths(query string) ([]string, error) {
r := fileQueryRegex.FindAllStringSubmatch(query, -1)
Expand Down
1 change: 1 addition & 0 deletions internal/utils/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func TestGetFilePaths(t *testing.T) {
{name: "Windows paths", paths: []string{"C:\\Documents\\Newsletters\\Summer2018.csv", "\\Program Files\\Custom Utilities\\StringFinder.csv"}},
{name: "Unix paths", paths: []string{"/Users/User/Documents/Data/test.csv"}},
{name: "With dash", paths: []string{"/Users/User/Documents/Data/test-1.csv"}},
{name: "With tilde", paths: []string{"C:\\Users\\User~1.U\\AppData\\Local\\Temp\\1479825193.csv", "~/Documents/Data/test.csv"}},
}

for _, quote := range quotes {
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package version

const DriverVersion = "v1.0.10"
const DriverVersion = "v1.0.11"

0 comments on commit fd74632

Please sign in to comment.