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
4ff6d273
Kaydet (Commit)
4ff6d273
authored
Agu 06, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Quote/unquote slashes in macintosh pathname components (Jack Jansen).
üst
9c241ba0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
macurl2path.py
Lib/macurl2path.py
+10
-4
No files found.
Lib/macurl2path.py
Dosyayı görüntüle @
4ff6d273
...
@@ -29,7 +29,7 @@ def url2pathname(pathname):
...
@@ -29,7 +29,7 @@ def url2pathname(pathname):
i
=
i
+
1
i
=
i
+
1
if
not
components
[
0
]:
if
not
components
[
0
]:
# Absolute unix path, don't start with colon
# Absolute unix path, don't start with colon
r
eturn
string
.
join
(
components
[
1
:],
':'
)
r
v
=
string
.
join
(
components
[
1
:],
':'
)
else
:
else
:
# relative unix path, start with colon. First replace
# relative unix path, start with colon. First replace
# leading .. by empty strings (giving ::file)
# leading .. by empty strings (giving ::file)
...
@@ -37,7 +37,9 @@ def url2pathname(pathname):
...
@@ -37,7 +37,9 @@ def url2pathname(pathname):
while
i
<
len
(
components
)
and
components
[
i
]
==
'..'
:
while
i
<
len
(
components
)
and
components
[
i
]
==
'..'
:
components
[
i
]
=
''
components
[
i
]
=
''
i
=
i
+
1
i
=
i
+
1
return
':'
+
string
.
join
(
components
,
':'
)
rv
=
':'
+
string
.
join
(
components
,
':'
)
# and finally unquote slashes and other funny characters
return
urllib
.
unquote
(
rv
)
def
pathname2url
(
pathname
):
def
pathname2url
(
pathname
):
"convert mac pathname to /-delimited pathname"
"convert mac pathname to /-delimited pathname"
...
@@ -54,13 +56,17 @@ def pathname2url(pathname):
...
@@ -54,13 +56,17 @@ def pathname2url(pathname):
if
components
[
i
]
==
''
:
if
components
[
i
]
==
''
:
components
[
i
]
=
'..'
components
[
i
]
=
'..'
# Truncate names longer than 31 bytes
# Truncate names longer than 31 bytes
components
=
map
(
lambda
x
:
x
[:
31
]
,
components
)
components
=
map
(
_pncomp2url
,
components
)
if
os
.
path
.
isabs
(
pathname
):
if
os
.
path
.
isabs
(
pathname
):
return
'/'
+
string
.
join
(
components
,
'/'
)
return
'/'
+
string
.
join
(
components
,
'/'
)
else
:
else
:
return
string
.
join
(
components
,
'/'
)
return
string
.
join
(
components
,
'/'
)
def
_pncomp2url
(
component
):
component
=
urllib
.
quote
(
component
[:
31
],
safe
=
''
)
# We want to quote slashes
return
component
def
test
():
def
test
():
for
url
in
[
"index.html"
,
for
url
in
[
"index.html"
,
"bar/index.html"
,
"bar/index.html"
,
...
...
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