I am trying to exclude all source map files, i.e files ending with .map
from being uploaded to app engine.
Here's a snippet of the config in app.yaml
file.
handlers:
- url: /(.*\\..+(?\<!map))$
static_files: \\1
upload: /(.*\\..+(?\<!map))$
secure: always
However, when deploying, this is the error that I get.
content <{
"error": {
"code": 400,
"message": "The request is invalid.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "version.handlers[0].url_regex",
"description": "Value \"/(.*\\..+(?\\\u003c!map))$\" must be a valid regular expression. Details: invalid or unsupported Perl syntax."
},
{
"field": "version.handlers[0].static_files.upload_path_regex",
"description": "Value \"/(.*\\..+(?\\\u003c!map))$\" must be a valid regular expression. Details: invalid or unsupported Perl syntax."
}
]
}
In the app.yaml
reference documentation, it implies that it supports POSIX extended regular expression syntax.
Might anyone advice on what should be done to fix this.
You can use
^(.*([^.].{3}|.[^m].{2}|.{2}[^a].|.{3}[^p])|.{0,3})$
See the regex demo. Details:
^
- start of string(.*([^.].{3}|.[^m].{2}|.{2}[^a].|.{3}[^p])|.{0,3})
- Group 1 matching:
.*([^.].{3}|.[^m].{2}|.{2}[^a].|.{3}[^p])
- any text, and then any of
[^.].{3}|
- a char other than a .
and then any 3 chars, or.[^m].{2}|
- any char, a char other than m
, and then any two chars, or.{2}[^a].|
- any two chars, any char other than a
, and then any one char.{3}[^p]
- any three chars, and then a char other than p
|
- or.{0,3}
- any zero, one, two or three chars.$
- end of string.