<commit_before>/*
 Route Adapters for SpaceDock Backend

 SpaceDock-Extras is licensed under the Terms of the MIT License.
 Copyright (c) 2017 <NAME> (StollD), RockyTV
*/

package adapter

import (
    "SpaceDock"
    "SpaceDock/routes"
    "SpaceDock/utils"
    "github.com/spf13/cast"
    "gopkg.in/kataras/iris.v6"
)

func init() {
    Register(GET, "/api/adapter/mods/:modid", mods_adapter)
}

/*
 Path: /api/adapter/mods/:modid
 Method: GET
 Description: Returns information for one mod
 */
func mods_adapter(ctx *iris.Context) {
    // Get params
    modid := cast.ToUint(ctx.GetString("modid"))

    // Get the mods gameshort
    mod := &objects.Mod{}
    SpaceDock.Database.Where("id = ?", modid).First(mod)
    if mod.ID != modid {
        utils.WriteJSON(ctx, iris.StatusNotFound, utils.Error("The modid is invalid").Code(2130))
        return<commit_msg>Bugfixing<commit_after>/*
 Route Adapters for SpaceDock Backend

 SpaceDock-Extras is licensed under the Terms of the MIT License.
 Copyright (c) 2017 <NAME> (StollD), RockyTV
*/

package adapter

import (
    "SpaceDock"
    "SpaceDock/routes"
    "SpaceDock/utils"
    "SpaceDock/objects"
    "github.com/spf13/cast"
    "gopkg.in/kataras/iris.v6"
)

func init() {
    routes.Register(routes.GET, "/api/adapter/mods/:modid", mods_adapter)
}

/*
 Path: /api/adapter/mods/:modid
 Method: GET
 Description: Returns information for one mod
 */
func mods_adapter(ctx *iris.Context) {
    // Get params
    modid := cast.ToUint(ctx.GetString("modid"))

    // Get the mods gameshort
    mod := &objects.Mod{}
    SpaceDock.Database.Where("id = ?", modid).First(mod)
    if mod.ID != modid {
        utils.WriteJSON(ctx, iris.StatusNotFound, utils.Error("The modid is invalid").Code(2130))
        return
{'fraction_non_alphanumeric': 0.1377551020408163, 'fraction_numerical': 0.012471655328798186, 'mean_word_length': 3.294403892944039, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7289629', 'n_tokens_mistral': 641, 'n_tokens_neox': 629, 'n_words': 140}