Possible bug in `get_asset_path`?
As mentioned in #2106, I think `nikola.util.get_asset_path` might have a bug, or it is used incorrectly. Or (third possiblity), I understand it wrongly what it is supposed to do.

I understand it as follows: if you want to know whether `output/bla/test.txt` is created by either the themes or by copying files (or already created by another plugin or by magic when called in `gen_tasks`), you do `get_asset_path('bla/test.txt', themes, files_folders)` and see if it returns `None` or a path.

I looked at how it is used for example in the `robots` plugin to detect whether `output/robots.txt` is created, and it seems to confirm my idea.

If that's correct, then it will fail in the following situation: assume that you have `file_folders = {'a': 'b'}` and have a file `a/bla/test.txt`. This will be copied to `output/b/bla/test.txt`. On the other hand, `get_asset_path('bla/test.txt', themes, files_folders)` will return `a/bla/test.txt`, so I assume that `output/bla/test.txt` will be created -- which it won't.

So -- do I understand it wrong what `get_asset_path` does, or is there a bug in its implementation? (Or am I somehow else confused? :) )

diff --git a/nikola/utils.py b/nikola/utils.py
index 0067b34e4..78a3fbb02 100644
--- a/nikola/utils.py
+++ b/nikola/utils.py
@@ -986,9 +986,12 @@ def get_asset_path(path, themes, files_folders={'files': ''}, _themes_dir='theme
     >>> print(get_asset_path('nikola.py', ['bootstrap3', 'base'], {'nikola': ''}))
     /.../nikola/nikola.py
 
-    >>> print(get_asset_path('nikola/nikola.py', ['bootstrap3', 'base'], {'nikola':'nikola'}))
+    >>> print(get_asset_path('nikola.py', ['bootstrap3', 'base'], {'nikola': 'nikola'}))
     None
 
+    >>> print(get_asset_path('nikola/nikola.py', ['bootstrap3', 'base'], {'nikola': 'nikola'}))
+    /.../nikola/nikola.py
+
     """
     for theme_name in themes:
         candidate = os.path.join(
@@ -998,9 +1001,11 @@ def get_asset_path(path, themes, files_folders={'files': ''}, _themes_dir='theme
         if os.path.isfile(candidate):
             return candidate
     for src, rel_dst in files_folders.items():
-        candidate = os.path.abspath(os.path.join(src, path))
-        if os.path.isfile(candidate):
-            return candidate
+        relpath = os.path.normpath(os.path.relpath(path, rel_dst))
+        if not relpath.startswith('..' + os.path.sep):
+            candidate = os.path.abspath(os.path.join(src, relpath))
+            if os.path.isfile(candidate):
+                return candidate
 
     if output_dir:
         candidate = os.path.join(output_dir, path)
['nikola/utils.py']