opentrace-community / opentrace-cloud-functions

OpenTrace Cloud Functions. Reference implementation of the BlueTrace protocol.
https://bluetrace.io
GNU General Public License v3.0
273 stars 121 forks source link

processUploadedData: File is not streetPassRecords, ignore. #56

Closed soriyasun closed 4 years ago

soriyasun commented 4 years ago

After UploadFragment: NOT-IDLE Uploading to Cloud Storage UploadFragment: NOT-IDLE uploaded successfully

Here is the file format received by processUploadedData processUploadedData: Detected new file: streetPassRecords/20200517/StreetPassRecord_Xiaomi_MI 9_2020-05-17_22-04-02.json

processUploadedData processUploadedData: File is not streetPassRecords, ignore.

What is missing here in the file format to go through all the Steps in processUploadedData ?

alexissinglaire commented 4 years ago

@soriyasun : i think there is a problem with the file name "StreetPassRecord_Xiaomi_MI 9_2020-05-17_22-04-02.json" as there is a space between the word "MI" and "9", and this cause the error during the file name validation in functions processUploadedData.ts

You can solve this by changing the android app on the class EnterPinFragment.kt inside routine "writeToInternalStorageAndUpload".

after this assignment val fileName = "StreetPassRecord${manufacturer}${model}_$date.json"

put additional code here to remove the space in between that exist inside the variable fileName

Hope it helps.

Good luck.

soriyasun commented 4 years ago

@alexissinglaire : Thanks a lot for the hint to solve this issue. By the way, I patched this code in processUploadedData 👍

if (filePath !== undefined && filePath.startsWith(config.upload.recordsDir) && filePath.endsWith('.json'))

Everything works fine. I can decrypt all TempId. The upload file has been moved to Archive bucket.

Thanks for your help. Take care

alexissinglaire commented 4 years ago

@soriyasun : Hi, can you share with us in detail how you solved this issue? thanks in advance.

soriyasun commented 4 years ago

@alexissinglaire Hi, here is the code I changed in processUploadedData

if (filePath !== undefined && filePath.startsWith('streetPassRecords') && filePath.endsWith('.json')) {

Just to force the functions to recognize the streetPathRecords file.

May be there was a bug with // if (filePath !== undefined && filePath.startsWith(config.upload.recordsDir) && filePath.endsWith('.json')) {

Hope this may help others. It solved my problem for now.

Take care Soriya

muchemwal commented 4 years ago

Hi @alexissinglaire,thank for the pointer. I would change the config setting for config.upload.recordsDir to "streetPassRecords" as there is 4 more references to the config in the processUploadedData code.