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

Loading…
Cancel
Save