fix condition type file

This commit is contained in:
Valentin CZERYBA 2023-04-02 17:36:17 +02:00
parent cb64dd47ab
commit ec4135c5d0

View File

@ -66,7 +66,7 @@ class WPimport:
if len(res) == 0:
data = page.content
img_type = "image/png"
if img_name.split(".")[1]:
if img_name.split(".")[1] == "jpg" or img_name.split(".")[1] == "jpeg":
img_type = "image/jpg"
headers={ 'Content-Type': img_type,'Content-Disposition' : 'attachment; filename={0}'.format(img_name)}
r = requests.post("http://{0}/wp-json/wp/v2/media".format(self._wordpress), auth=self._basic, headers=headers, data=data)