diff options
| author | Fleutot <fleutot@gmail.com> | 2013-12-11 18:13:34 +0100 |
|---|---|---|
| committer | Fleutot <fleutot@gmail.com> | 2013-12-11 18:13:34 +0100 |
| commit | ca0cf6232d3cf672ca9abf06f0c64c5584baac9d (patch) | |
| tree | f6824ac90ef0432bbc17bf6a90022c96e9d9071f /src | |
| parent | f154f7e7741fe91850cb0bd4b537ccfaf32e1511 (diff) | |
| download | luarocks-ca0cf6232d3cf672ca9abf06f0c64c5584baac9d.tar.gz luarocks-ca0cf6232d3cf672ca9abf06f0c64c5584baac9d.tar.bz2 luarocks-ca0cf6232d3cf672ca9abf06f0c64c5584baac9d.zip | |
Fixed an improper error message
Forgot to check that type=="string" before doing pattern matching on a field content.
Was triggered when version was provided as a string in a luarock.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/type_check.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua index 5436bde6..a3d41efc 100644 --- a/src/luarocks/type_check.lua +++ b/src/luarocks/type_check.lua | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | |||
| 2 | --- Type-checking functions. | 1 | --- Type-checking functions. |
| 3 | -- Functions and definitions for doing a basic lint check on files | 2 | -- Functions and definitions for doing a basic lint check on files |
| 4 | -- loaded by LuaRocks. | 3 | -- loaded by LuaRocks. |
| @@ -183,7 +182,9 @@ local function type_check_item(name, item, expected, context) | |||
| 183 | return nil, "Type mismatch on field "..context..name..": expected a string" | 182 | return nil, "Type mismatch on field "..context..name..": expected a string" |
| 184 | end | 183 | end |
| 185 | if expected ~= "string" then | 184 | if expected ~= "string" then |
| 186 | if not item:match("^"..expected.."$") then | 185 | if item_type ~= "string" then |
| 186 | return nil, "Type mismatch on field "..context..name..": expected a string, got a "..type(item) | ||
| 187 | elseif not item:match("^"..expected.."$") then | ||
| 187 | return nil, "Type mismatch on field "..context..name..": invalid value "..item.." does not match '"..expected.."'" | 188 | return nil, "Type mismatch on field "..context..name..": invalid value "..item.." does not match '"..expected.."'" |
| 188 | end | 189 | end |
| 189 | end | 190 | end |
