Skip to content

Commit

Permalink
Merge pull request #30 from NfoAlex/FixFileUploads
Browse files Browse the repository at this point in the history
Fix file uploads
  • Loading branch information
NfoAlex committed Jun 28, 2023
2 parents 1ff222c + 2fefd3f commit 3069022
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,9 @@ let msgMix = function msgMix(m) {

//ファイルが添付されているなら
if ( m.fileData.isAttatched ) {
console.log("ファイル処理作業始めるわ");
//添付ファイルへID振り分け
// for ( let index in m.fileData.attatchmentData ) {
// //IDは日付+チャンネルID+ユーザーID+乱数8桁
// m.fileData.attatchmentData[index].fileid = m.channelid + m.userid + parseInt(Math.random()*99999999);
//ID振り分け用の時間データ
let t = new Date();

// }
let receivedDatePath = t.getFullYear() + "_" + (t.getMonth()+1).toString().padStart(2,0) + "_" + t.getDate().toString().padStart(2,0);
writeUploadedFile(m.fileData, m.channelid, receivedDatePath); //ファイル処理開始

Expand Down Expand Up @@ -684,7 +680,7 @@ let msgRecord = function msgRecord(json) {
//ファイルIDの振り分け
for ( let index in json.fileData.attatchmentData ) {
//IDは日付+ユーザーID+乱数8桁
json.fileData.attatchmentData[index].fileid = json.time + json.userid + parseInt(Math.random()*99999999);
json.fileData.attatchmentData[index].fileid = receivedTime + json.userid + parseInt(Math.random()*99999999);

}

Expand All @@ -697,8 +693,6 @@ let msgRecord = function msgRecord(json) {
size: json.fileData.attatchmentData[index].size,
type: json.fileData.attatchmentData[index].type,
};
//delete json.fileData.attatchmentData[index].name;
//delete json.fileData.attatchmentData[index].size;
} catch(e) {
console.log("Message :: msgRecord : ファイルID記録に失敗");
}
Expand Down

0 comments on commit 3069022

Please sign in to comment.