fix: [Paste] create absolute path

This commit is contained in:
Terrtia 2018-10-24 15:16:12 +02:00
parent 15901d2865
commit 8a6ac6be1e
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -82,6 +82,10 @@ class Paste(object):
db=cfg.getint("ARDB_Metadata", "db"), db=cfg.getint("ARDB_Metadata", "db"),
decode_responses=True) decode_responses=True)
PASTES_FOLDER = os.path.join(os.environ['AIL_HOME'], cfg.get("Directories", "pastes"))
if PASTES_FOLDER not in p_path:
p_path = os.path.join(PASTES_FOLDER, p_path)
self.p_path = p_path self.p_path = p_path
self.p_name = os.path.basename(self.p_path) self.p_name = os.path.basename(self.p_path)
self.p_size = round(os.path.getsize(self.p_path)/1024.0, 2) self.p_size = round(os.path.getsize(self.p_path)/1024.0, 2)