aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar z411 2019-04-01 16:52:42 -0300
committerLibravatar z411 2019-04-01 16:52:42 -0300
commitfd7a16dd0c1e81db7f3282b0518b248ebb374377 (patch)
tree2d8e5ca76caeec317dc6f637870d5d7a76ee92b8
parentff6bf1b045fa810989a3efc78624123d3fc97f19 (diff)
downloadweabot-fd7a16dd0c1e81db7f3282b0518b248ebb374377.tar.gz
weabot-fd7a16dd0c1e81db7f3282b0518b248ebb374377.tar.xz
weabot-fd7a16dd0c1e81db7f3282b0518b248ebb374377.zip
oekaki: Usando os.path.join
PS: En realidad esta es la forma correcta de trabajar con directorios en Python. Lo ideal sería corregir la aplicación completa para que se utilice (en vez de concats ordinarios) y quitar el trailing slash desde los directorios en la configuración.
-rw-r--r--cgi/oekaki.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cgi/oekaki.py b/cgi/oekaki.py
index 14c3a1d..e20316c 100644
--- a/cgi/oekaki.py
+++ b/cgi/oekaki.py
@@ -116,7 +116,7 @@ def oekaki(self, path_split):
board = setBoard(path_split[3])
ip = inet_aton(self.environ["REMOTE_ADDR"])
- fname = "%s/%s/temp/%d.png" % (Settings.IMAGES_DIR, board['dir'], ip)
+ fname = os.path.join(Settings.IMAGES_DIR, board['dir'], "temp", str(ip) + ".png")
if path_split[4] == 'b64':
page = write_from_base64(fname, self.formdata['image'])
@@ -139,7 +139,7 @@ def oekaki(self, path_split):
ts = int(time.time())
ip = inet_aton(self.environ["REMOTE_ADDR"])
- fname = "%s/%s/temp/%d.png" % (Settings.IMAGES_DIR, board['dir'], ip)
+ fname = os.path.join(Settings.IMAGES_DIR, board['dir'], "temp", str(ip) + ".png")
oek = 'no'
if 'filebase' in self.formdata:
@@ -213,4 +213,4 @@ def write_from_shi(fname, fp):
with open(fname, 'wb') as f:
f.write(img)
- return "OK" \ No newline at end of file
+ return "OK"