Skip to content

ShareCheck

Namespace Nfty.Core.Publish.Community in assembly Nfty.Core.

public static class ShareCheck

Decides whether a packed Set may go in the community gallery. This half judges the ARCHIVE itself, without extracting anything: a public gallery takes files from strangers, so a zip bomb, a path that climbs out of its folder, a link, or a stray file must be refused before any reader opens the contents.

Remarks

Everything here reports; nothing throws, so every surface can show the same sentences (ShareRules). Sizes and the entry count come from the zip's central directory, which a hostile file can lie about, so a consumer that extracts must still enforce its own limits while reading; this check refuses what is visibly wrong.

Methods

CheckArchive(string)

public static IReadOnlyList<string> CheckArchive(string setPath);

Inspects the archive at setPath and lists what keeps it out of the gallery.

Parameters

  • setPath (string) - A packed .set file.

Returns. Problems in ShareRules' words; empty when the archive is safe and shaped like a Set. A hostile archive yields one problem and stops there.

CheckAsync(string, CancellationToken)

public static Task<ShareFacts> CheckAsync(string setPath, CancellationToken ct = default);

Judges a packed Set for the gallery: the archive first, then the Set inside it.

Parameters

  • setPath (string) - A packed .set file.
  • ct (CancellationToken) - Stops the check; the only thing that throws.

Returns. The facts the gallery lists, or the problems that keep the Set out (facts then carry defaults). Bad input never throws: every failure becomes a sentence from ShareRules.