polymath-apps icon indicating copy to clipboard operation
polymath-apps copied to clipboard

Issue with Whitelist header Row checks

Open F-OBrien opened this issue 6 years ago • 4 comments

The whitelist header row checks appear to be shifted by one. For example if you take the template whitelist and simply delete the "is Accredited" and "Non-Accredited Limit" columns you get an error per below. As these columns are not required unless the Pegged STO is attached this should not result in an error. image If you delete the Exempt from "Exempt From % Ownership" column you get image delete the "Can Buy From STO" column you get image

F-OBrien avatar Apr 01 '19 13:04 F-OBrien

Further to the above if the header is simply renamed it seems to give the correct error message. The column header error shift seems to only happen when columns are completely deleted. I've attached the whitelist file that gives me this error in case it has some how it become incorrectly formatted by simply opening in excel deleting the last two columns and saving.

whitelist-sample (12).zip

F-OBrien avatar Apr 01 '19 14:04 F-OBrien

Ok I believe the issue may be that excel adds a carriage return where there would only have been a new line (LF) with the original file. this possibly explains why I've had errors reported by the last line of whitelists edited in excel also. If this is the case it should be handled or some clear guidance should be provided to issuers about editing the .csv file to ensure it remains functional.

Original image After Edit in Excel image

F-OBrien avatar Apr 01 '19 15:04 F-OBrien

Thanks @F-OBrien for opening this issue! Taking a look at this now.

sajclarke avatar Apr 01 '19 16:04 sajclarke

I believe changing this line https://github.com/PolymathNetwork/polymath-apps/blob/2ba08cc912d6eb7834df19dcd39be4eb93a0fda0/packages/polymath-issuer/src/utils/parsers/index.js#L73

to let rows = data.split(/\r\n|\r|\n/); or let rows = data.split(/\r?\n/); should resolve this issue and allow imports of csv files edited on both Windows and UNIX systems

F-OBrien avatar Apr 06 '19 11:04 F-OBrien