Page MenuHomePhabricator

[services] Backup - Tools - validate attachment holders
ClosedPublic

Authored by karol on May 26 2022, 3:05 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 8:47 AM
Unknown Object (File)
Tue, Nov 5, 3:14 PM
Unknown Object (File)
Fri, Oct 25, 12:08 AM
Unknown Object (File)
Fri, Oct 25, 12:08 AM
Unknown Object (File)
Fri, Oct 25, 12:08 AM
Unknown Object (File)
Fri, Oct 25, 12:08 AM
Unknown Object (File)
Fri, Oct 25, 12:08 AM
Unknown Object (File)
Oct 14 2024, 1:00 PM

Details

Summary

Depends on D4080

Adding parseAttachmentHolders function that splits received attachments by the delimiter and performs some sanity checks.

Test Plan

Services can still be built normally. For a full test plan of this functionality, please see D4135

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested changes to this revision.May 27 2022, 5:46 AM
tomek added inline comments.
services/backup/src/Tools.cpp
36–53 ↗(On Diff #13141)

This function doesn't make sense for me. We take holders that is a ATTACHMENT_DELIMITER-separated string, then split by ATTACHMENT_DELIMITER and finally construct ATTACHMENT_DELIMITER-separated string again.

I think parse function should take a string and return some type of structure. In this case, I would expect that parse function takes a string and returns a vector with strings.

It might be possible that the behavior of this function is what was intended - but then we should find a better name, e.g. validateAttachmentHolders.

41 ↗(On Diff #13141)

If we assume that ATTACHMENT_DELIMITER is one char long, maybe we should use char instead?

This revision now requires changes to proceed.May 27 2022, 5:46 AM
services/backup/src/Tools.cpp
36–53 ↗(On Diff #13141)

validateAttachmentHolders sounds ok to me. The point here is to indeed validate the data that we got from the client. I think we better stay with std::string as a result.

41 ↗(On Diff #13141)

we can store this as char

karol retitled this revision from [services] Backup - Tools - parse attachment holders to [services] Backup - Tools - validate attachment holders.May 27 2022, 6:44 AM
tomek requested changes to this revision.May 30 2022, 3:59 AM
tomek added inline comments.
services/backup/src/Tools.cpp
42–44 ↗(On Diff #13155)

Are you sure we need to throw here? What if an id is something like aaa::bbb?

This revision now requires changes to proceed.May 30 2022, 3:59 AM
tomek added inline comments.
services/backup/src/Tools.cpp
42–44 ↗(On Diff #13155)

Sorry, my comment doesn't make sense - please ignore it.

This revision is now accepted and ready to land.May 30 2022, 4:46 AM