Skip to content

Commit a919d9d

Browse files
committed
Clean up logging / remove thumbnail save attempt
1 parent 7bf29cc commit a919d9d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

main.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyRespo
4040
parseEnvironment()
4141

4242
// Verify the webhook url has been set
43+
log.Printf("PLEX2SLACK_WEBHOOK_URL from environment: %+v\n", webhookURL)
4344

4445
// Step zero: Decode the body:
4546
s, err := base64.StdEncoding.DecodeString(request.Body)
4647
if err != nil {
47-
log.Printf("There was an error base64 decoding the body: %v", err)
48+
log.Printf("There was an error base64 decoding the body: %v\n", err)
4849
return events.APIGatewayProxyResponse{
4950
StatusCode: http.StatusBadRequest,
5051
Headers: map[string]string{
@@ -56,14 +57,13 @@ func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyRespo
5657
}
5758

5859
// Print out what we have
59-
log.Printf("%+v\n", string(s))
60-
61-
log.Printf("Headers: %+v\n", request.Headers)
60+
// log.Printf("%+v\n", string(s))
61+
// log.Printf("Headers: %+v\n", request.Headers)
6262

6363
// First, get the content type. Throw an error if we can't
6464
mediaType, params, err := mime.ParseMediaType(request.Headers["Content-Type"])
6565
if err != nil {
66-
log.Printf("There was an error getting the content type: %v", err)
66+
log.Printf("There was an error getting the content type: %v\n", err)
6767
return events.APIGatewayProxyResponse{
6868
StatusCode: http.StatusUnsupportedMediaType,
6969
Headers: map[string]string{
@@ -79,19 +79,17 @@ func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyRespo
7979

8080
// Break apart the content into its parts
8181
readForm := multipart.NewReader(strings.NewReader(string(s)), params["boundary"])
82-
log.Printf("DEBUG:: boundary: %v\n", params["boundary"])
82+
// log.Printf("DEBUG:: boundary: %v\n", params["boundary"])
8383

8484
for {
8585
part, errPart := readForm.NextPart()
8686
if errPart == io.EOF {
8787
break
8888
}
8989
if part.FormName() == "thumb" {
90-
partBytes, _ := ioutil.ReadAll(part)
91-
err := ioutil.WriteFile("thumb.jpg", partBytes, 0644)
92-
if err != nil {
93-
fmt.Printf("Error saving thumbnail: %v\n", err)
94-
}
90+
/*
91+
No op
92+
*/
9593
} else if part.FormName() == "payload" {
9694
partBytes, _ := ioutil.ReadAll(part)
9795
msg := data.PlexMessage{}

0 commit comments

Comments
 (0)