From f9842abe1005eea75aaca580e8f2d16fb38794be Mon Sep 17 00:00:00 2001 From: Gallyus <5572280+francinum@users.noreply.github.com> Date: Thu, 8 Jul 2021 21:34:55 -0400 Subject: [PATCH 1/2] Fixes admin template uploads (#4768) * Fixes admin template uploads If an empty string (rustg null) is returned after loading, loading will be attempted again with native handling * Tag uploads by admin and servetime to make them easier to find --- code/modules/admin/verbs/map_template_loadverb.dm | 4 ++-- code/modules/mapping/reader.dm | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/verbs/map_template_loadverb.dm b/code/modules/admin/verbs/map_template_loadverb.dm index 0e687c8b045..66206636e15 100644 --- a/code/modules/admin/verbs/map_template_loadverb.dm +++ b/code/modules/admin/verbs/map_template_loadverb.dm @@ -39,9 +39,9 @@ var/datum/map_template/M switch(alert(src, "What kind of map is this?", "Map type", "Normal", "Shuttle", "Cancel")) if("Normal") - M = new /datum/map_template(map, "[map]", TRUE) + M = new /datum/map_template(map, "[map] - Uploaded by [ckey] at [time2text(world.timeofday,"YYYY-MM-DD hh:mm:ss")]", TRUE) if("Shuttle") - M = new /datum/map_template/shuttle(map, "[map]", TRUE) + M = new /datum/map_template/shuttle(map, "[map] - Uploaded by [ckey] at [time2text(world.timeofday,"YYYY-MM-DD hh:mm:ss")]", TRUE) else return if(!M.cached_map) diff --git a/code/modules/mapping/reader.dm b/code/modules/mapping/reader.dm index 05e4183ce57..f69c4c62a9b 100644 --- a/code/modules/mapping/reader.dm +++ b/code/modules/mapping/reader.dm @@ -55,7 +55,11 @@ /datum/parsed_map/New(tfile, x_lower = -INFINITY, x_upper = INFINITY, y_lower = -INFINITY, y_upper=INFINITY, measureOnly=FALSE) if(isfile(tfile)) original_path = "[tfile]" + var/temp_hack_garbage = tfile tfile = rustg_file_read(tfile) + //This is hacky garbage + if(tfile == "") //Might be an upload, try raw loading it. + tfile = file2text(temp_hack_garbage) else if(isnull(tfile)) // create a new datum without loading a map return From c8813af327c3b71cb5f1f0e4e1026b875e924854 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 9 Jul 2021 01:35:36 +0000 Subject: [PATCH 2/2] Fixes admin template uploads