Skip to content

Commit

Permalink
fix(SqlCache): modify typeSanitization regex to filter MySQL non-perm…
Browse files Browse the repository at this point in the history
…itted chars (#3839)
  • Loading branch information
Pere authored and robzienert committed Jul 3, 2019
1 parent 752bd1d commit e358c99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SqlCache(
private val schemaVersion = SqlSchemaVersion.current()
private val useRegexp = """.*[\?\[].*""".toRegex()
private val cleanRegexp = """\.+\*""".toRegex()
private val typeSanitization = """[:/\-]""".toRegex()
private val typeSanitization = """[^A-Za-z0-9_]""".toRegex()

private val log = LoggerFactory.getLogger(SqlCache::class.java)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ class SqlCacheSpec extends WriteableCacheSpec {
SqlTestUtil.cleanupDb(context)
}

def 'should handle invalid type'() {
given:
def data = createData('blerp', [a: 'b'])
((SqlCache) cache).merge('foo.bar', data)

when:
def retrieved = ((SqlCache) cache).getAll('foo.bar')

then:
retrieved.size() == 1
retrieved.findAll { it.id == "blerp" }.size() == 1
}

def 'should not write an item if it is unchanged'() {
setup:
def data = createData('blerp', [a: 'b'])
Expand Down

0 comments on commit e358c99

Please sign in to comment.