-1

i'm using flask and want to have blueprint like my code below. i want to generated encrypted url link return and imagefile display in web browser. i read itsdangerous module but have no idea how to return raw image file( png,jpg,gif etc) @blueprint.route("/") def image_file_link_encrypt(encryptlink): return send_file(imagefilelocation)

how to accomplished this, since i'm new in python/programming i have no idea how to create this. the reason why i need this because the path of the file contain email address of user(information disclosure) the existing system in php, i want to build the same url scheme in flask microframework i read other post in How to serve static files in Flask but have no idea how to code for my scenario. Thanks

Community
  • 1
  • 1
user1288188
  • 67
  • 1
  • 1
  • 4

1 Answers1

1

isdangerous based on hash functions and hmac - it mean you can encode your path string, but very hard decode it (you can just verify it).

One of methods just create path with cryptographic random or take hash of body|real path and store url and real file name in database.

Another way to use invertible cipher as AES.

tbicr
  • 24,790
  • 12
  • 81
  • 106