Browse Source

fix skin name

master
poikilos 6 years ago
committed by Jacob Gustafson
parent
commit
d8379b9756
  1. 12
      webapp/server.js

12
webapp/server.js

@ -335,13 +335,13 @@ app.post('/set-skin', function (req, res){
//(OldCoder, 2019) //(OldCoder, 2019)
var directPath = ""; var directPath = "";
var indirectPath = ""; var indirectPath = "";
var destName = ""; var destNameNoExt = "";
var msg = "Uploading..."; var msg = "Uploading...";
form.parse(req, function(err, fields, files) { form.parse(req, function(err, fields, files) {
if (err) next(err); if (err) next(err);
destName = destName = "player_" + fields.userName; destNameNoExt = destNameNoExt = "player_" + fields.userName;
directPath = skinDir + "/" + destName + ".png"; directPath = skinDir + "/" + destNameNoExt + ".png";
indirectPath = skinDir + "/" + destName + ".skin"; indirectPath = skinDir + "/" + destNameNoExt + ".skin";
// TODO: make sure my_file and project_id values are present // TODO: make sure my_file and project_id values are present
if (files.userFile != undefined) { if (files.userFile != undefined) {
var originalPath = files.userFile.path; var originalPath = files.userFile.path;
@ -355,9 +355,9 @@ app.post('/set-skin', function (req, res){
next(err); next(err);
} }
else { else {
fs.writeFile(indirectPath, destName, function(err, data) { fs.writeFile(indirectPath, destNameNoExt + ".skin", function(err, data) {
if (err) console.log(err); if (err) console.log(err);
console.log("Successfully wrote " + destName console.log("Successfully wrote " + destNameNoExt
+ " to "+indirectPath+"."); + " to "+indirectPath+".");
}); });
} }

Loading…
Cancel
Save