File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ exports.blurOffensiveImages = async event => {
6363// Blurs the given file using ImageMagick, and uploads it to another bucket.
6464const blurImage = async ( file , blurredBucketName ) => {
6565 const tempLocalPath = `/tmp/${ path . parse ( file . name ) . base } ` ;
66- const tempLocalBlurredPath = `/tmp/blurred-${ path . parse ( file . name ) . base } ` ; // 1. Declarar la variable
66+ const tempLocalBlurredPath = `/tmp/blurred-${ path . parse ( file . name ) . base } ` ;
6767
6868 // Download file from bucket.
6969 try {
@@ -98,6 +98,6 @@ const blurImage = async (file, blurredBucketName) => {
9898
9999 // Delete the temporary file.
100100 await fs . unlink ( tempLocalPath ) ;
101- return fs . unlink ( tempLocalBlurredPath ) ;
101+ return await fs . unlink ( tempLocalBlurredPath ) ;
102102} ;
103103// [END functions_imagemagick_blur]
Original file line number Diff line number Diff line change 1515'use strict' ;
1616
1717const assert = require ( 'assert' ) ;
18- const { execSync , spawn} = require ( 'child_process' ) ;
18+ const { spawn} = require ( 'child_process' ) ;
1919const { Storage} = require ( '@google-cloud/storage' ) ;
2020const sinon = require ( 'sinon' ) ;
2121const { request} = require ( 'gaxios' ) ;
@@ -62,11 +62,6 @@ async function startFF(port) {
6262 return { ffProc, ffProcHandler} ;
6363}
6464
65- // ImageMagick is available by default in Cloud Run Functions environments
66- // https://cloud.google.com/functions/1stgendocs/tutorials/imagemagick-1st-gen.md#importing_dependencies
67- // Manually install it for testing only.
68- //execSync('sudo apt-get install imagemagick -y');
69-
7065describe ( 'functions/imagemagick tests' , ( ) => {
7166 before ( async ( ) => {
7267 let exists ;
@@ -178,7 +173,7 @@ describe('functions/imagemagick tests', () => {
178173
179174 after ( async ( ) => {
180175 try {
181- // await blurredBucket.file(testFiles.offensive).delete();
176+ await blurredBucket . file ( testFiles . offensive ) . delete ( ) ;
182177 } catch ( err ) {
183178 console . log ( 'Error deleting uploaded file:' , err . message ) ;
184179 }
You can’t perform that action at this time.
0 commit comments