Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
c69d40f9
Kaydet (Commit)
c69d40f9
authored
Agu 22, 2018
tarafından
winkidney
Kaydeden (comit)
Tim Graham
Agu 23, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29705 -- Fixed ImageField RuntimeError crash for WebP files.
üst
586a9dc4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
images.py
django/core/files/images.py
+4
-0
test.webp
tests/files/test.webp
+0
-0
tests.py
tests/files/tests.py
+6
-0
No files found.
django/core/files/images.py
Dosyayı görüntüle @
c69d40f9
...
...
@@ -69,6 +69,10 @@ def get_image_dimensions(file_or_path, close=False):
# less bytes than expected. Skip and feed more data to the
# parser (ticket #24544).
pass
except
RuntimeError
:
# e.g. "RuntimeError: could not create decoder object" for
# WebP files. A different chunk_size may work.
pass
if
p
.
image
:
return
p
.
image
.
size
chunk_size
*=
2
...
...
tests/files/test.webp
0 → 100644
Dosyayı görüntüle @
c69d40f9
File added
tests/files/tests.py
Dosyayı görüntüle @
c69d40f9
...
...
@@ -343,6 +343,12 @@ class GetImageDimensionsTests(unittest.TestCase):
size
=
images
.
get_image_dimensions
(
fh
)
self
.
assertEqual
(
size
,
(
None
,
None
))
def
test_webp
(
self
):
img_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test.webp'
)
with
open
(
img_path
,
'rb'
)
as
fh
:
size
=
images
.
get_image_dimensions
(
fh
)
self
.
assertEqual
(
size
,
(
540
,
405
))
class
FileMoveSafeTests
(
unittest
.
TestCase
):
def
test_file_move_overwrite
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment