DDF-416 Correct logic to break out of loop on success
DDF-416 Only add size if URI is present and valid.

As suggested by Jeff Vettraino and agreed by Shaun Morris on ddf-developers mailing list.
Merge pull request #4 from bradh/master

DDF-416 Correct logic to break out of loop on success
Reviewed by: @mrmateo