Skip to content

Commit

Permalink
fix: upload document based on header type
Browse files Browse the repository at this point in the history
  • Loading branch information
shridarpatil committed May 3, 2024
1 parent c148415 commit 3926ea5
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def validate(self):
lang_code = frappe.db.get_value("Language", self.language) or "en"
self.language_code = lang_code.replace("-", "_")

self.get_session_id()
self.get_media_id()
if self.header_type in ["IMAGE", "DOCUMENT"] and self.sample:
self.get_session_id()
self.get_media_id()

if not self.is_new():
self.update_template()
Expand All @@ -31,11 +32,11 @@ def get_session_id(self):
self.get_settings()
file_path = self.get_absolute_path(self.sample)
mime = magic.Magic(mime=True)
mime.from_file(file_path)
file_type = mime.from_file(file_path)

payload = {
'file_length': os.path.getsize(file_path),
'file_type': 'image/png',
'file_type': file_type,
'messaging_product': 'whatsapp'
}

Expand Down

0 comments on commit 3926ea5

Please sign in to comment.