Add todo because hanging guthub actions
*/
package com.artipie.api;
+import com.amihaiemil.eoyaml.Yaml;
import com.amihaiemil.eoyaml.YamlMapping;
import com.artipie.Settings;
import com.artipie.YamlPermissions;
+import com.artipie.asto.Concatenation;
+import com.artipie.asto.Remaining;
import com.artipie.http.Slice;
import com.artipie.http.async.AsyncSlice;
import com.artipie.http.rt.RtRule;
@@ -42,6 +45,7 @@ import com.github.jknack.handlebars.io.ClassPathTemplateLoader;
import com.github.jknack.handlebars.io.TemplateLoader;
import hu.akarnokd.rxjava2.interop.SingleInterop;
import io.reactivex.Single;
+import java.nio.charset.StandardCharsets;
import java.util.regex.Pattern;
/**
@@ -63,6 +67,10 @@ public final class DashboardSlice extends Slice.Wrap {
* Primary ctor.
* @param settings Settings
* @param tpl Template loader for pages
+ * @todo #730:30min When `ContentAs` is used here instead of `Concatenation` and
+ * `Remaining` `ArtipieApiITCase` get stuck on github actions (this does not happen
+ * locally on windows os), figure out why, make necessary corrections and
+ * use `ContentAs` here. Probably this problem is similar to artipie/artipie#790.
*/
private DashboardSlice(final Settings settings, final TemplateLoader tpl) {
// @checkstyle LineLengthCheck (100 lines)
@@ -70,11 +78,13 @@ public final class DashboardSlice extends Slice.Wrap {
new AsyncSlice(
Single.zip(
Single.fromCallable(settings::auth).flatMap(SingleInterop::fromFuture),
- Single.fromCallable(settings::storage).<YamlMapping>flatMap(
+ Single.fromCallable(settings::storage).flatMap(
storage -> SingleInterop.fromFuture(
new ConfigFile("_permissions.yaml").valueFrom(storage)
- ).to(new ContentAsYaml())
- ).map(yaml -> yaml.yamlMapping("permissions"))
+ ).flatMap(data -> new Concatenation(data).single())
+ ).map(buf -> new Remaining(buf).bytes())
+ .map(bytes -> Yaml.createYamlInput(new String(bytes, StandardCharsets.UTF_8)).readYamlMapping())
+ .map(yaml -> yaml.yamlMapping("permissions"))
.map(YamlPermissions::new),
(auth, perm) -> new ApiAuthSlice(
auth, perm,
