Skip to content

Commit

Permalink
Merge pull request #936 from Chia-Network/feat/metadata_key_fix
Browse files Browse the repository at this point in the history
feat: remove meta_ prefix from metadata keys
  • Loading branch information
TheLastCicada authored Oct 11, 2023
2 parents c6841ae + 7855be9 commit 200d556
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/controllers/organization.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,15 @@ export const getMetaData = async (req, res) => {
where: { orgUid: req.query.orgUid },
});

return res.json(JSON.parse(organization.metadata));
const rawMetadata = JSON.parse(organization.metadata);
const cleanedMetadata = {};

for (const [key, value] of Object.entries(rawMetadata)) {
const newKey = key.startsWith('meta_') ? key.substring(5) : key;
cleanedMetadata[newKey] = value;
}

return res.json(cleanedMetadata);
} catch (error) {
res.status(400).json({
message: 'Error getting metadata for organization',
Expand Down

0 comments on commit 200d556

Please sign in to comment.