Fixed dollar escaping and end value
This commit is contained in:
@@ -1602,11 +1602,13 @@ class AppBase:
|
||||
escape_replacement = "\\%\\%\\%\\%\\%"
|
||||
end_variable = "^_^"
|
||||
|
||||
print("Input value: %s" % parameter["value"])
|
||||
#print("Input value: %s" % parameter["value"])
|
||||
try:
|
||||
parameter["value"] = parameter["value"].replace(escaped_dollar, escape_replacement, -1)
|
||||
except:
|
||||
print("Error in initial replacement!")
|
||||
print("Error in initial replacement of escaped dollar!")
|
||||
|
||||
#print("POST input value: %s" % parameter["value"])
|
||||
|
||||
# Regex to find all the things
|
||||
if parameter["variant"] == "STATIC_VALUE":
|
||||
@@ -1728,6 +1730,14 @@ class AppBase:
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
parameter["value"] = parameter["value"].replace(to_be_replaced, value)
|
||||
|
||||
#print("PRE Replaced data: %s" % parameter["value"])
|
||||
|
||||
try:
|
||||
parameter["value"] = parameter["value"].replace(end_variable, "", -1)
|
||||
parameter["value"] = parameter["value"].replace(escape_replacement, "$", -1)
|
||||
except:
|
||||
print("Error in datareplacement")
|
||||
|
||||
# Just here in case it breaks
|
||||
# Implemented 02.08.2021
|
||||
#print("Pre liquid: %s" % parameter["value"])
|
||||
@@ -1736,14 +1746,9 @@ class AppBase:
|
||||
except:
|
||||
pass
|
||||
|
||||
#print("POST liquid: %s" % parameter["value"])
|
||||
try:
|
||||
parameter["value"] = parameter["value"].replace(end_variable, "", -1)
|
||||
parameter["value"] = parameter["value"].replace(escape_replacement, escaped_dollar, -1)
|
||||
except:
|
||||
print("Error in datareplacement")
|
||||
pass
|
||||
#print("Replaced data: %s" % parameter["value"])
|
||||
|
||||
#print("POST liquid: %s" % parameter["value"])
|
||||
return "", parameter["value"], is_loop
|
||||
|
||||
def run_validation(sourcevalue, check, destinationvalue):
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
GOOS=linux go build main.go
|
||||
zip function.zip main
|
||||
|
||||
aws lambda update-function-code \
|
||||
--function-name shuffler-forwarder \
|
||||
--runtime go1.* \
|
||||
--zip-file fileb://function.zip \
|
||||
--handler main \
|
||||
--role arn:aws:iam::123456789012:role/execution_role
|
||||
@@ -1,66 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
//"encoding/json"
|
||||
//"fmt"
|
||||
"github.com/aws/aws-lambda-go/lambda"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type LambdaPayload struct {
|
||||
RequestContext struct {
|
||||
Elb struct {
|
||||
TargetGroupArn string `json:"targetGroupArn"`
|
||||
} `json:"elb"`
|
||||
} `json:"requestContext"`
|
||||
HTTPMethod string `json:"httpMethod"`
|
||||
Path string `json:"path"`
|
||||
Headers map[string]string `json:"headers"`
|
||||
QueryStringParameters map[string]string `json:"queryStringParameters"`
|
||||
Body string `json:"body"`
|
||||
IsBase64Encoded bool `json:"isBase64Encoded"`
|
||||
}
|
||||
|
||||
type LambdaResponse struct {
|
||||
IsBase64Encoded bool `json:"isBase64Encoded"`
|
||||
StatusCode int `json:"statusCode"`
|
||||
StatusDescription string `json:"statusDescription"`
|
||||
Headers struct {
|
||||
SetCookie string `json:"Set-cookie"`
|
||||
ContentType string `json:"Content-Type"`
|
||||
} `json:"headers"`
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
func lambda_handler(ctx context.Context, payload LambdaPayload) (LambdaResponse, error) {
|
||||
response := &LambdaResponse{}
|
||||
response.Headers.ContentType = "text/html"
|
||||
response.StatusCode = http.StatusBadRequest
|
||||
response.StatusDescription = http.StatusText(http.StatusBadRequest)
|
||||
if payload.HTTPMethod == http.MethodGet && payload.Path == "/myfavoritecar" {
|
||||
res := "TEST"
|
||||
//car := &Car{}
|
||||
//car.Model = "Corvette"
|
||||
//car.Color = "Red"
|
||||
//car.Year = 1999
|
||||
//res, err := json.Marshal(car)
|
||||
//if err != nil {
|
||||
// fmt.Println(err)
|
||||
// response.StatusCode = http.StatusInternalServerError
|
||||
// response.StatusDescription = http.StatusText(http.StatusInternalServerError)
|
||||
// return *response, err
|
||||
//}
|
||||
response.Headers.ContentType = "application/json"
|
||||
response.Body = string(res)
|
||||
response.StatusCode = http.StatusOK
|
||||
response.StatusDescription = http.StatusText(http.StatusOK)
|
||||
return *response, nil
|
||||
} else {
|
||||
return *response, nil
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
lambda.Start(lambda_handler)
|
||||
}
|
||||
Reference in New Issue
Block a user