Kaynağa Gözat

Slight fix to file server

master
Roderic Day 5 yıl önce
ebeveyn
işleme
0412be6245
1 değiştirilmiş dosya ile 6 ekleme ve 3 silme
  1. +6
    -3
      pico.py

+ 6
- 3
pico.py Dosyayı Görüntüle

@@ -19,15 +19,18 @@ class PicoProtocol(websockets.WebSocketServerProtocol):
document = Path(__file__, '..', Path(path).name).resolve()
if not document.is_file():
document = Path(__file__, '..', 'pico.html').resolve()

if document.suffix == '.html':
content_type = 'text/html; charset=utf-8'
elif path.endswith('.js'):
elif document.suffix == '.js':
content_type = 'application/javascript; charset=utf-8'
elif path.endswith('.css'):
elif document.suffix == '.css':
content_type = 'text/css; charset=utf-8'
elif path.endswith('.svg'):
elif document.suffix == '.svg':
content_type = 'image/svg+xml; charset=utf-8'
else:
content_type = 'text/plain; charset=utf-8'

return (
http.HTTPStatus.OK,
[('Content-Type', content_type)],

Yükleniyor…
İptal
Kaydet