Skip to content
Snippets Groups Projects
Commit 9dbde0fa authored by MinJae Kwon's avatar MinJae Kwon
Browse files

Merge branch 'temp-remove-host' into 'main'

chore: remove the host for profile image temporarily

See merge request !50
parents 3e318afb c5a71afd
No related branches found
No related tags found
1 merge request!50chore: remove the host for profile image temporarily
......@@ -32,6 +32,11 @@ exports.buildFullImageUrl = (objectName) => {
return `http://${MINIO.PUBLIC_ENDPOINT}:${MINIO.PORT}/${objectName}`;
}
exports.removeHostFromImageUrl = (imageUrl) => {
const url = new URL(imageUrl);
return url.pathname;
}
exports.uploadImage = async (req, res) => {
upload.single('image')(req, res, async (err) => {
if (err) {
......
......@@ -9,7 +9,7 @@ const Crew = require('../models/Crew');
const Event = require('../models/Event');
const UserCrew = require('../models/UserCrew');
const EventParticipants = require('../models/EventParticipants');
const {buildFullImageUrl} = require('./imageController');
const {buildFullImageUrl, removeHostFromImageUrl} = require('./imageController');
const authTokenExpiryTime = '1h';
const listItemsPerPage = 10;
......@@ -245,7 +245,7 @@ exports.updateUser = async (req, res) => {
userProfile = await user.getProfile({transaction: tx});
if (userProfile) {
// TODO: Save the image to storage and save the URL to the database
if (profile.profileImage) userProfile.profileImage = profile.profileImage;
if (profile.profileImage) userProfile.profileImage = removeHostFromImageUrl(profile.profileImage);
if (profile.regionID) userProfile.regionID = profile.regionID;
if (profile.job) userProfile.job = profile.job;
if (profile.birthDate) userProfile.birthDate = profile.birthDate;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment