Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
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
cpython
Commits
0d12ead0
Kaydet (Commit)
0d12ead0
authored
Şub 14, 1996
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Try to normalize urls referring to local files (code copied from posixpath)
üst
e708f400
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
urllib.py
Lib/urllib.py
+15
-3
No files found.
Lib/urllib.py
Dosyayı görüntüle @
0d12ead0
...
@@ -33,8 +33,20 @@ if os.name == 'mac':
...
@@ -33,8 +33,20 @@ if os.name == 'mac':
if
tp
and
tp
<>
'file'
:
if
tp
and
tp
<>
'file'
:
raise
RuntimeError
,
'Cannot convert non-local URL to pathname'
raise
RuntimeError
,
'Cannot convert non-local URL to pathname'
components
=
string
.
split
(
pathname
,
'/'
)
components
=
string
.
split
(
pathname
,
'/'
)
if
'..'
in
components
or
'.'
in
components
or
''
in
components
[
1
:
-
1
]:
i
=
0
raise
RuntimeError
,
'Cannot convert URL containing ., .. or // to pathname'
while
i
<
len
(
components
):
if
components
[
i
]
==
'.'
:
del
components
[
i
]
elif
components
[
i
]
==
'..'
and
i
>
0
and
\
components
[
i
-
1
]
not
in
(
''
,
'..'
):
del
components
[
i
-
1
:
i
+
1
]
i
=
i
-
1
elif
components
[
i
]
==
''
and
i
>
0
and
components
[
i
-
1
]
<>
''
:
del
components
[
i
]
else
:
i
=
i
+
1
if
not
components
or
'..'
in
components
or
'.'
in
components
or
''
in
components
[
1
:
-
1
]:
raise
RuntimeError
,
'Cannot normalize URL containing ., .. or // to pathname'
if
not
components
[
0
]:
if
not
components
[
0
]:
# Absolute unix path, don't start with colon
# Absolute unix path, don't start with colon
return
string
.
join
(
components
[
1
:],
':'
)
return
string
.
join
(
components
[
1
:],
':'
)
...
@@ -475,7 +487,7 @@ class ftpwrapper:
...
@@ -475,7 +487,7 @@ class ftpwrapper:
if
file
:
cmd
=
'LIST '
+
file
if
file
:
cmd
=
'LIST '
+
file
else
:
cmd
=
'LIST'
else
:
cmd
=
'LIST'
conn
=
self
.
ftp
.
transfercmd
(
cmd
)
conn
=
self
.
ftp
.
transfercmd
(
cmd
)
return
addclosehook
(
conn
.
makefile
(
'r'
),
self
.
ftp
.
voidresp
)
return
addclosehook
(
conn
.
makefile
(
'r
b
'
),
self
.
ftp
.
voidresp
)
# Base class for addinfo and addclosehook
# Base class for addinfo and addclosehook
class
addbase
:
class
addbase
:
...
...
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