Skip to content

Commit

Permalink
Merge pull request #946 from Chia-Network/revert-939-revert-936-feat/…
Browse files Browse the repository at this point in the history
…metadata_key_fix

Revert "Revert "feat: remove meta_ prefix from metadata keys""
  • Loading branch information
MichaelTaylor3D authored Oct 20, 2023
2 parents 534b0ec + 7e9c9ce commit b392cc6
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 b392cc6

Please sign in to comment.